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.

fix(registry): publish complete install dependency graphs

Aniket-50839c75c1abbba
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index eef9e93..acdcfb9 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -31,6 +31,8 @@ pnpm build
This builds the shadcn registry first, then the Next.js app.
+When changing a registry item, run `pnpm registry:build` (`apps/web/scripts/build-registry.mts`). The source manifest is `apps/web/registry.json`; the build publishes `apps/web/public/r/*.json`, rewrites source-only `@/registry/` imports to the installed file targets, and checks that every item has a complete isolated dependency closure (including package dependencies). Declare imports from other items in `registryDependencies`; do not edit the generated JSON by hand.
+
## Testing
```bash
diff --git a/apps/web/package.json b/apps/web/package.json
index 2887557..2c5561d 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -8,7 +8,7 @@
"build": "pnpm registry:build && next build",
"start": "next start",
"typecheck": "tsc --noEmit",
- "registry:build": "shadcn build",
+ "registry:build": "tsx scripts/build-registry.mts",
"postinstall": "fumadocs-mdx"
},
"dependencies": {
diff --git a/apps/web/public/r/forme/alert.json b/apps/web/public/r/forme/alert.json
index adb628f..c0e0a15 100644
--- a/apps/web/public/r/forme/alert.json
+++ b/apps/web/public/r/forme/alert.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/forme/components/alert/alert.tsx",
- "content": "import type { ReactNode } from \"react\";\r\n\r\nimport {\r\n mergePdfStyles,\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport {\r\n Text as PDFText,\r\n StyleSheet,\r\n View,\r\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport { Circle, Line, Path, Svg } from \"@/registry/bases/forme/lib/pdf-svg\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type AlertVariant = \"info\" | \"success\" | \"warning\" | \"error\";\r\n\r\n/**\r\n * Alert box with severity variants for info, success, warning, and error states.\r\n * Props - `variant` | `title` | `children` | `showIcon` | `showBorder` | `style`\r\n * @see {@link PdfAlertProps}\r\n */\r\nexport interface PdfAlertProps extends Omit<PDFComponentProps, \"children\"> {\r\n /**\r\n * @default 'info'\r\n */\r\n variant?: AlertVariant;\r\n title?: string;\r\n children?: ReactNode;\r\n /**\r\n * @default true\r\n */\r\n showIcon?: boolean;\r\n /**\r\n * @default true\r\n */\r\n showBorder?: boolean;\r\n}\r\n\r\n/** Stroke width for all alert SVG icons (SVG user units). */\r\nconst ICON_STROKE_WIDTH = 1.5;\r\n\r\nconst SvgWrap = ({ children }: { children: ReactNode }) => (\r\n <Svg width={16} height={16} viewBox=\"0 0 16 16\">\r\n {children}\r\n </Svg>\r\n);\r\n\r\nconst ICON_MAP = {\r\n error: ({ color }: { color: string }) => (\r\n <SvgWrap>\r\n <Circle\r\n cx={8}\r\n cy={8}\r\n r={7}\r\n fill=\"none\"\r\n stroke={color}\r\n strokeWidth={ICON_STROKE_WIDTH}\r\n />\r\n <Line\r\n x1={5.5}\r\n y1={5.5}\r\n x2={10.5}\r\n y2={10.5}\r\n stroke={color}\r\n strokeWidth={ICON_STROKE_WIDTH}\r\n strokeLinecap=\"round\"\r\n />\r\n <Line\r\n x1={10.5}\r\n y1={5.5}\r\n x2={5.5}\r\n y2={10.5}\r\n stroke={color}\r\n strokeWidth={ICON_STROKE_WIDTH}\r\n strokeLinecap=\"round\"\r\n />\r\n </SvgWrap>\r\n ),\r\n info: ({ color }: { color: string }) => (\r\n <SvgWrap>\r\n <Circle\r\n cx={8}\r\n cy={8}\r\n r={7}\r\n fill=\"none\"\r\n stroke={color}\r\n strokeWidth={ICON_STROKE_WIDTH}\r\n />\r\n <Circle cx={8} cy={4.5} r={1} fill={color} />\r\n <Line\r\n x1={8}\r\n y1={7}\r\n x2={8}\r\n y2={11.5}\r\n stroke={color}\r\n strokeWidth={ICON_STROKE_WIDTH}\r\n strokeLinecap=\"round\"\r\n />\r\n </SvgWrap>\r\n ),\r\n success: ({ color }: { color: string }) => (\r\n <SvgWrap>\r\n <Circle\r\n cx={8}\r\n cy={8}\r\n r={7}\r\n fill=\"none\"\r\n stroke={color}\r\n strokeWidth={ICON_STROKE_WIDTH}\r\n />\r\n <Path\r\n d=\"M5 8 L7 10 L11 6\"\r\n fill=\"none\"\r\n stroke={color}\r\n strokeWidth={ICON_STROKE_WIDTH}\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n />\r\n </SvgWrap>\r\n ),\r\n warning: ({ color }: { color: string }) => (\r\n <SvgWrap>\r\n <Path\r\n d=\"M8 1.5 L15 14.5 L1 14.5 Z\"\r\n fill=\"none\"\r\n stroke={color}\r\n strokeWidth={ICON_STROKE_WIDTH}\r\n strokeLinejoin=\"round\"\r\n />\r\n <Line\r\n x1={8}\r\n y1={6}\r\n x2={8}\r\n y2={10}\r\n stroke={color}\r\n strokeWidth={ICON_STROKE_WIDTH}\r\n strokeLinecap=\"round\"\r\n />\r\n <Circle cx={8} cy={12.5} r={0.75} fill={color} />\r\n </SvgWrap>\r\n ),\r\n};\r\n\r\nconst AlertIcon = ({\r\n variant,\r\n color,\r\n}: {\r\n variant: AlertVariant;\r\n color: string;\r\n}) => {\r\n const Icon = ICON_MAP[variant];\r\n return <Icon color={color} />;\r\n};\r\n\r\nconst borderLeft = (color: string) => ({\r\n borderLeftColor: color,\r\n borderLeftWidth: 4,\r\n});\r\n\r\nconst createAlertStyles = (theme: PdfcnTheme) => {\r\n const { typography, colors, primitives } = theme;\r\n\r\n const variantColors = {\r\n error: colors.destructive ?? \"#EF4444\",\r\n info: colors.info ?? \"#3B82F6\",\r\n success: colors.success ?? \"#22C55E\",\r\n warning: colors.warning ?? \"#F59E0B\",\r\n } satisfies Record<AlertVariant, string>;\r\n\r\n const sheet = StyleSheet.create({\r\n bg: {\r\n backgroundColor: colors.muted,\r\n },\r\n borderError: borderLeft(variantColors.error),\r\n borderInfo: borderLeft(variantColors.info),\r\n borderSuccess: borderLeft(variantColors.success),\r\n borderWarning: borderLeft(variantColors.warning),\r\n container: {\r\n borderRadius: 4,\r\n flexDirection: \"row\",\r\n marginBottom: theme.spacing.componentGap,\r\n padding: 12,\r\n },\r\n contentContainer: { flex: 1 },\r\n description: {\r\n color: colors.mutedForeground,\r\n fontFamily: typography.body.fontFamily,\r\n fontSize: primitives.typography.sm,\r\n lineHeight: typography.body.lineHeight,\r\n },\r\n iconContainer: {\r\n alignItems: \"center\",\r\n justifyContent: \"flex-start\",\r\n marginRight: 10,\r\n paddingTop: 2,\r\n width: 20,\r\n },\r\n title: {\r\n color: colors.foreground,\r\n fontFamily: typography.heading.fontFamily,\r\n fontSize: primitives.typography.sm,\r\n fontWeight: primitives.fontWeights.semibold,\r\n marginBottom: 4,\r\n },\r\n });\r\n\r\n return {\r\n ...sheet,\r\n borderMap: {\r\n error: sheet.borderError,\r\n info: sheet.borderInfo,\r\n success: sheet.borderSuccess,\r\n warning: sheet.borderWarning,\r\n } as Record<AlertVariant, Style>,\r\n /** Resolved hex colors for each variant — used to tint the SVG icons. */\r\n variantColors,\r\n };\r\n};\r\n\r\nexport const PdfAlert = ({\r\n variant = \"info\",\r\n title,\r\n children,\r\n showIcon = true,\r\n showBorder = true,\r\n style,\r\n}: PdfAlertProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createAlertStyles(theme), [theme]);\r\n\r\n if (!title && !children) {\r\n return null;\r\n }\r\n\r\n const containerStyles: Style[] = [\r\n styles.container,\r\n styles.bg,\r\n ...(showBorder ? [styles.borderMap[variant]] : []),\r\n ...(style ? [style].flat() : []),\r\n ];\r\n\r\n return (\r\n <View wrap={false} style={mergePdfStyles(containerStyles)}>\r\n {showIcon && (\r\n <View style={styles.iconContainer}>\r\n <AlertIcon variant={variant} color={styles.variantColors[variant]} />\r\n </View>\r\n )}\r\n <View style={styles.contentContainer}>\r\n {title && <PDFText style={styles.title}>{title}</PDFText>}\r\n {typeof children === \"string\" ? (\r\n <PDFText style={styles.description}>{children}</PDFText>\r\n ) : (\r\n children\r\n )}\r\n </View>\r\n </View>\r\n );\r\n};\r\n",
+ "content": "import type { ReactNode } from \"react\";\n\nimport {\n mergePdfStyles,\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { Circle, Line, Path, Svg } from \"@/lib/pdf-svg\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type AlertVariant = \"info\" | \"success\" | \"warning\" | \"error\";\n\n/**\n * Alert box with severity variants for info, success, warning, and error states.\n * Props - `variant` | `title` | `children` | `showIcon` | `showBorder` | `style`\n * @see {@link PdfAlertProps}\n */\nexport interface PdfAlertProps extends Omit<PDFComponentProps, \"children\"> {\n /**\n * @default 'info'\n */\n variant?: AlertVariant;\n title?: string;\n children?: ReactNode;\n /**\n * @default true\n */\n showIcon?: boolean;\n /**\n * @default true\n */\n showBorder?: boolean;\n}\n\n/** Stroke width for all alert SVG icons (SVG user units). */\nconst ICON_STROKE_WIDTH = 1.5;\n\nconst SvgWrap = ({ children }: { children: ReactNode }) => (\n <Svg width={16} height={16} viewBox=\"0 0 16 16\">\n {children}\n </Svg>\n);\n\nconst ICON_MAP = {\n error: ({ color }: { color: string }) => (\n <SvgWrap>\n <Circle\n cx={8}\n cy={8}\n r={7}\n fill=\"none\"\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n />\n <Line\n x1={5.5}\n y1={5.5}\n x2={10.5}\n y2={10.5}\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinecap=\"round\"\n />\n <Line\n x1={10.5}\n y1={5.5}\n x2={5.5}\n y2={10.5}\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinecap=\"round\"\n />\n </SvgWrap>\n ),\n info: ({ color }: { color: string }) => (\n <SvgWrap>\n <Circle\n cx={8}\n cy={8}\n r={7}\n fill=\"none\"\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n />\n <Circle cx={8} cy={4.5} r={1} fill={color} />\n <Line\n x1={8}\n y1={7}\n x2={8}\n y2={11.5}\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinecap=\"round\"\n />\n </SvgWrap>\n ),\n success: ({ color }: { color: string }) => (\n <SvgWrap>\n <Circle\n cx={8}\n cy={8}\n r={7}\n fill=\"none\"\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n />\n <Path\n d=\"M5 8 L7 10 L11 6\"\n fill=\"none\"\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </SvgWrap>\n ),\n warning: ({ color }: { color: string }) => (\n <SvgWrap>\n <Path\n d=\"M8 1.5 L15 14.5 L1 14.5 Z\"\n fill=\"none\"\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinejoin=\"round\"\n />\n <Line\n x1={8}\n y1={6}\n x2={8}\n y2={10}\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinecap=\"round\"\n />\n <Circle cx={8} cy={12.5} r={0.75} fill={color} />\n </SvgWrap>\n ),\n};\n\nconst AlertIcon = ({\n variant,\n color,\n}: {\n variant: AlertVariant;\n color: string;\n}) => {\n const Icon = ICON_MAP[variant];\n return <Icon color={color} />;\n};\n\nconst borderLeft = (color: string) => ({\n borderLeftColor: color,\n borderLeftWidth: 4,\n});\n\nconst createAlertStyles = (theme: PdfcnTheme) => {\n const { typography, colors, primitives } = theme;\n\n const variantColors = {\n error: colors.destructive ?? \"#EF4444\",\n info: colors.info ?? \"#3B82F6\",\n success: colors.success ?? \"#22C55E\",\n warning: colors.warning ?? \"#F59E0B\",\n } satisfies Record<AlertVariant, string>;\n\n const sheet = StyleSheet.create({\n bg: {\n backgroundColor: colors.muted,\n },\n borderError: borderLeft(variantColors.error),\n borderInfo: borderLeft(variantColors.info),\n borderSuccess: borderLeft(variantColors.success),\n borderWarning: borderLeft(variantColors.warning),\n container: {\n borderRadius: 4,\n flexDirection: \"row\",\n marginBottom: theme.spacing.componentGap,\n padding: 12,\n },\n contentContainer: { flex: 1 },\n description: {\n color: colors.mutedForeground,\n fontFamily: typography.body.fontFamily,\n fontSize: primitives.typography.sm,\n lineHeight: typography.body.lineHeight,\n },\n iconContainer: {\n alignItems: \"center\",\n justifyContent: \"flex-start\",\n marginRight: 10,\n paddingTop: 2,\n width: 20,\n },\n title: {\n color: colors.foreground,\n fontFamily: typography.heading.fontFamily,\n fontSize: primitives.typography.sm,\n fontWeight: primitives.fontWeights.semibold,\n marginBottom: 4,\n },\n });\n\n return {\n ...sheet,\n borderMap: {\n error: sheet.borderError,\n info: sheet.borderInfo,\n success: sheet.borderSuccess,\n warning: sheet.borderWarning,\n } as Record<AlertVariant, Style>,\n /** Resolved hex colors for each variant — used to tint the SVG icons. */\n variantColors,\n };\n};\n\nexport const PdfAlert = ({\n variant = \"info\",\n title,\n children,\n showIcon = true,\n showBorder = true,\n style,\n}: PdfAlertProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createAlertStyles(theme), [theme]);\n\n if (!title && !children) {\n return null;\n }\n\n const containerStyles: Style[] = [\n styles.container,\n styles.bg,\n ...(showBorder ? [styles.borderMap[variant]] : []),\n ...(style ? [style].flat() : []),\n ];\n\n return (\n <View wrap={false} style={mergePdfStyles(containerStyles)}>\n {showIcon && (\n <View style={styles.iconContainer}>\n <AlertIcon variant={variant} color={styles.variantColors[variant]} />\n </View>\n )}\n <View style={styles.contentContainer}>\n {title && <PDFText style={styles.title}>{title}</PDFText>}\n {typeof children === \"string\" ? (\n <PDFText style={styles.description}>{children}</PDFText>\n ) : (\n children\n )}\n </View>\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/alert/alert.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/badge.json b/apps/web/public/r/forme/badge.json
index 64efc05..add8df4 100644
--- a/apps/web/public/r/forme/badge.json
+++ b/apps/web/public/r/forme/badge.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/forme/components/badge/badge.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport {\r\n Text as PDFText,\r\n StyleSheet,\r\n View,\r\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type BadgeVariant =\r\n | \"default\"\r\n | \"primary\"\r\n | \"success\"\r\n | \"warning\"\r\n | \"destructive\"\r\n | \"info\"\r\n | \"outline\";\r\nexport type BadgeSize = \"sm\" | \"md\" | \"lg\";\r\n\r\n/**\r\n * Inline label for status, tags, or categories.\r\n *\r\n * Accepts text via either `label` prop or `children` (string). `label` takes\r\n * precedence when both are provided. The children pattern (`<Badge>text</Badge>`)\r\n * is supported for compatibility with common React idioms, but note that\r\n * `@formepdf/react` doesn't support JSX children the way HTML does — only\r\n * string children are accepted.\r\n *\r\n * Props - `label` | `children` | `variant` | `size` | `background` | `color` | `style`\r\n * @see {@link BadgeProps}\r\n */\r\nexport interface BadgeProps extends Omit<PDFComponentProps, \"children\"> {\r\n /** Text to display. Takes precedence over children when both are provided. */\r\n label?: string;\r\n /** String children as an alternative to the label prop. */\r\n children?: string;\r\n /**\r\n * @default 'default'\r\n */\r\n variant?: BadgeVariant;\r\n /**\r\n * @default 'md'\r\n */\r\n size?: BadgeSize;\r\n background?: string;\r\n color?: string;\r\n}\r\n\r\nconst createBadgeStyles = (t: PdfcnTheme) => {\r\n const { spacing, borderRadius, fontWeights } = t.primitives;\r\n const c = t.colors;\r\n const textBase = {\r\n fontFamily: t.typography.body.fontFamily,\r\n fontWeight: fontWeights.semibold,\r\n letterSpacing: 0.3,\r\n };\r\n const variantBox = (borderColor: string, bgColor: string = c.muted) => ({\r\n backgroundColor: bgColor,\r\n borderColor,\r\n borderStyle: \"solid\" as const,\r\n borderWidth: spacing[0.5],\r\n });\r\n const sheet = StyleSheet.create({\r\n containerBase: {\r\n alignItems: \"center\" as const,\r\n alignSelf: \"flex-start\" as const,\r\n borderRadius: borderRadius.full,\r\n flexDirection: \"row\" as const,\r\n },\r\n sizeLg: { paddingHorizontal: spacing[4], paddingVertical: spacing[2] },\r\n sizeMd: { paddingHorizontal: spacing[3], paddingVertical: spacing[1] },\r\n sizeSm: { paddingHorizontal: spacing[2], paddingVertical: spacing[0.5] },\r\n textDefault: { ...textBase, color: c.mutedForeground },\r\n textDestructive: { ...textBase, color: c.destructive },\r\n textInfo: { ...textBase, color: c.info },\r\n textLg: { fontSize: t.primitives.typography.sm },\r\n textMd: { fontSize: t.primitives.typography.xs },\r\n textOutline: { ...textBase, color: c.foreground },\r\n textPrimary: { ...textBase, color: c.primaryForeground },\r\n textSm: { fontSize: t.primitives.typography.xs - 1 },\r\n textSuccess: { ...textBase, color: c.success },\r\n textWarning: { ...textBase, color: c.warning },\r\n variantDefault: variantBox(c.border),\r\n variantDestructive: variantBox(c.destructive),\r\n variantInfo: variantBox(c.info),\r\n variantOutline: variantBox(c.border, c.background),\r\n variantPrimary: variantBox(c.primary, c.primary),\r\n variantSuccess: variantBox(c.success),\r\n variantWarning: variantBox(c.warning),\r\n });\r\n return {\r\n ...sheet,\r\n containerSizeMap: {\r\n lg: sheet.sizeLg,\r\n md: sheet.sizeMd,\r\n sm: sheet.sizeSm,\r\n } as Record<BadgeSize, Style>,\r\n containerVariantMap: {\r\n default: sheet.variantDefault,\r\n destructive: sheet.variantDestructive,\r\n info: sheet.variantInfo,\r\n outline: sheet.variantOutline,\r\n primary: sheet.variantPrimary,\r\n success: sheet.variantSuccess,\r\n warning: sheet.variantWarning,\r\n } as Record<BadgeVariant, Style>,\r\n textSizeMap: {\r\n lg: sheet.textLg,\r\n md: sheet.textMd,\r\n sm: sheet.textSm,\r\n } as Record<BadgeSize, Style>,\r\n textVariantMap: {\r\n default: sheet.textDefault,\r\n destructive: sheet.textDestructive,\r\n info: sheet.textInfo,\r\n outline: sheet.textOutline,\r\n primary: sheet.textPrimary,\r\n success: sheet.textSuccess,\r\n warning: sheet.textWarning,\r\n } as Record<BadgeVariant, Style>,\r\n };\r\n};\r\n\r\nexport const Badge = ({\r\n label,\r\n children,\r\n variant = \"default\",\r\n size = \"md\",\r\n background,\r\n color,\r\n style,\r\n}: BadgeProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createBadgeStyles(theme), [theme]);\r\n // `label` takes precedence; fall back to string children for React idiom compatibility\r\n const text = label ?? children ?? \"\";\r\n const containerStyles: Style[] = [\r\n styles.containerBase,\r\n styles.containerVariantMap[variant],\r\n styles.containerSizeMap[size],\r\n ...(background\r\n ? [{ backgroundColor: resolveColor(background, theme.colors) }]\r\n : []),\r\n ...(style ? [style].flat() : []),\r\n ];\r\n const textStyles: Style[] = [\r\n styles.textVariantMap[variant],\r\n styles.textSizeMap[size],\r\n ...(color ? [{ color: resolveColor(color, theme.colors) }] : []),\r\n ];\r\n return (\r\n <View style={containerStyles as never}>\r\n <PDFText style={textStyles as never}>{text}</PDFText>\r\n </View>\r\n );\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type BadgeVariant =\n | \"default\"\n | \"primary\"\n | \"success\"\n | \"warning\"\n | \"destructive\"\n | \"info\"\n | \"outline\";\nexport type BadgeSize = \"sm\" | \"md\" | \"lg\";\n\n/**\n * Inline label for status, tags, or categories.\n *\n * Accepts text via either `label` prop or `children` (string). `label` takes\n * precedence when both are provided. The children pattern (`<Badge>text</Badge>`)\n * is supported for compatibility with common React idioms, but note that\n * `@formepdf/react` doesn't support JSX children the way HTML does — only\n * string children are accepted.\n *\n * Props - `label` | `children` | `variant` | `size` | `background` | `color` | `style`\n * @see {@link BadgeProps}\n */\nexport interface BadgeProps extends Omit<PDFComponentProps, \"children\"> {\n /** Text to display. Takes precedence over children when both are provided. */\n label?: string;\n /** String children as an alternative to the label prop. */\n children?: string;\n /**\n * @default 'default'\n */\n variant?: BadgeVariant;\n /**\n * @default 'md'\n */\n size?: BadgeSize;\n background?: string;\n color?: string;\n}\n\nconst createBadgeStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius, fontWeights } = t.primitives;\n const c = t.colors;\n const textBase = {\n fontFamily: t.typography.body.fontFamily,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.3,\n };\n const variantBox = (borderColor: string, bgColor: string = c.muted) => ({\n backgroundColor: bgColor,\n borderColor,\n borderStyle: \"solid\" as const,\n borderWidth: spacing[0.5],\n });\n const sheet = StyleSheet.create({\n containerBase: {\n alignItems: \"center\" as const,\n alignSelf: \"flex-start\" as const,\n borderRadius: borderRadius.full,\n flexDirection: \"row\" as const,\n },\n sizeLg: { paddingHorizontal: spacing[4], paddingVertical: spacing[2] },\n sizeMd: { paddingHorizontal: spacing[3], paddingVertical: spacing[1] },\n sizeSm: { paddingHorizontal: spacing[2], paddingVertical: spacing[0.5] },\n textDefault: { ...textBase, color: c.mutedForeground },\n textDestructive: { ...textBase, color: c.destructive },\n textInfo: { ...textBase, color: c.info },\n textLg: { fontSize: t.primitives.typography.sm },\n textMd: { fontSize: t.primitives.typography.xs },\n textOutline: { ...textBase, color: c.foreground },\n textPrimary: { ...textBase, color: c.primaryForeground },\n textSm: { fontSize: t.primitives.typography.xs - 1 },\n textSuccess: { ...textBase, color: c.success },\n textWarning: { ...textBase, color: c.warning },\n variantDefault: variantBox(c.border),\n variantDestructive: variantBox(c.destructive),\n variantInfo: variantBox(c.info),\n variantOutline: variantBox(c.border, c.background),\n variantPrimary: variantBox(c.primary, c.primary),\n variantSuccess: variantBox(c.success),\n variantWarning: variantBox(c.warning),\n });\n return {\n ...sheet,\n containerSizeMap: {\n lg: sheet.sizeLg,\n md: sheet.sizeMd,\n sm: sheet.sizeSm,\n } as Record<BadgeSize, Style>,\n containerVariantMap: {\n default: sheet.variantDefault,\n destructive: sheet.variantDestructive,\n info: sheet.variantInfo,\n outline: sheet.variantOutline,\n primary: sheet.variantPrimary,\n success: sheet.variantSuccess,\n warning: sheet.variantWarning,\n } as Record<BadgeVariant, Style>,\n textSizeMap: {\n lg: sheet.textLg,\n md: sheet.textMd,\n sm: sheet.textSm,\n } as Record<BadgeSize, Style>,\n textVariantMap: {\n default: sheet.textDefault,\n destructive: sheet.textDestructive,\n info: sheet.textInfo,\n outline: sheet.textOutline,\n primary: sheet.textPrimary,\n success: sheet.textSuccess,\n warning: sheet.textWarning,\n } as Record<BadgeVariant, Style>,\n };\n};\n\nexport const Badge = ({\n label,\n children,\n variant = \"default\",\n size = \"md\",\n background,\n color,\n style,\n}: BadgeProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createBadgeStyles(theme), [theme]);\n // `label` takes precedence; fall back to string children for React idiom compatibility\n const text = label ?? children ?? \"\";\n const containerStyles: Style[] = [\n styles.containerBase,\n styles.containerVariantMap[variant],\n styles.containerSizeMap[size],\n ...(background\n ? [{ backgroundColor: resolveColor(background, theme.colors) }]\n : []),\n ...(style ? [style].flat() : []),\n ];\n const textStyles: Style[] = [\n styles.textVariantMap[variant],\n styles.textSizeMap[size],\n ...(color ? [{ color: resolveColor(color, theme.colors) }] : []),\n ];\n return (\n <View style={containerStyles as never}>\n <PDFText style={textStyles as never}>{text}</PDFText>\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/badge/badge.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/card.json b/apps/web/public/r/forme/card.json
index 06cdd5b..3956050 100644
--- a/apps/web/public/r/forme/card.json
+++ b/apps/web/public/r/forme/card.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/forme/components/card/card.tsx",
- "content": "import type { ReactNode } from \"react\";\r\n\r\nimport {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport {\r\n Text as PDFText,\r\n StyleSheet,\r\n View,\r\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type CardVariant = \"default\" | \"bordered\" | \"muted\";\r\n\r\n/**\r\n * Bordered content card with optional title and padding presets.\r\n * Props - `title` | `children` | `variant` | `padding` | `wrap` | `style`\r\n * @see {@link PdfCardProps}\r\n */\r\nexport interface PdfCardProps extends Omit<PDFComponentProps, \"children\"> {\r\n title?: string;\r\n children?: ReactNode;\r\n /**\r\n * @default 'default'\r\n */\r\n variant?: CardVariant;\r\n /**\r\n * @default 'md'\r\n */\r\n padding?: \"sm\" | \"md\" | \"lg\";\r\n /**\r\n * When false, the card will not split across PDF pages.\r\n * @default false\r\n */\r\n wrap?: boolean;\r\n}\r\n\r\nconst createCardStyles = (t: PdfcnTheme) => {\r\n const { spacing, borderRadius, fontWeights } = t.primitives;\r\n return StyleSheet.create({\r\n body: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n lineHeight: t.typography.body.lineHeight,\r\n },\r\n card: {\r\n backgroundColor: t.colors.background,\r\n borderColor: t.colors.border,\r\n borderRadius: borderRadius.sm,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n marginBottom: t.spacing.componentGap,\r\n },\r\n cardBordered: { borderWidth: 2 },\r\n cardMuted: { backgroundColor: t.colors.muted },\r\n paddingLg: { padding: spacing[4] },\r\n paddingMd: { padding: spacing[3] },\r\n paddingSm: { padding: spacing[2] },\r\n title: {\r\n borderBottomColor: t.colors.border,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: 1,\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.heading.fontFamily,\r\n fontSize: t.primitives.typography.base,\r\n fontWeight: fontWeights.semibold,\r\n lineHeight: t.typography.heading.lineHeight,\r\n marginBottom: spacing[2],\r\n paddingBottom: spacing[1] + 2,\r\n },\r\n });\r\n};\r\n\r\nexport const PdfCard = ({\r\n title,\r\n children,\r\n variant = \"default\",\r\n padding = \"md\",\r\n wrap = false,\r\n style,\r\n}: PdfCardProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createCardStyles(theme), [theme]);\r\n const paddingMap = {\r\n lg: styles.paddingLg,\r\n md: styles.paddingMd,\r\n sm: styles.paddingSm,\r\n };\r\n const cardStyles: Style[] = [styles.card];\r\n if (variant === \"bordered\") {\r\n cardStyles.push(styles.cardBordered);\r\n }\r\n if (variant === \"muted\") {\r\n cardStyles.push(styles.cardMuted);\r\n }\r\n cardStyles.push(paddingMap[padding]);\r\n if (style) {\r\n cardStyles.push(style);\r\n }\r\n return (\r\n <View wrap={wrap} style={cardStyles as never}>\r\n {title ? <PDFText style={styles.title}>{title}</PDFText> : null}\r\n {typeof children === \"string\" ? (\r\n <PDFText style={styles.body}>{children}</PDFText>\r\n ) : (\r\n children\r\n )}\r\n </View>\r\n );\r\n};\r\n",
+ "content": "import type { ReactNode } from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type CardVariant = \"default\" | \"bordered\" | \"muted\";\n\n/**\n * Bordered content card with optional title and padding presets.\n * Props - `title` | `children` | `variant` | `padding` | `wrap` | `style`\n * @see {@link PdfCardProps}\n */\nexport interface PdfCardProps extends Omit<PDFComponentProps, \"children\"> {\n title?: string;\n children?: ReactNode;\n /**\n * @default 'default'\n */\n variant?: CardVariant;\n /**\n * @default 'md'\n */\n padding?: \"sm\" | \"md\" | \"lg\";\n /**\n * When false, the card will not split across PDF pages.\n * @default false\n */\n wrap?: boolean;\n}\n\nconst createCardStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius, fontWeights } = t.primitives;\n return StyleSheet.create({\n body: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n lineHeight: t.typography.body.lineHeight,\n },\n card: {\n backgroundColor: t.colors.background,\n borderColor: t.colors.border,\n borderRadius: borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: 1,\n marginBottom: t.spacing.componentGap,\n },\n cardBordered: { borderWidth: 2 },\n cardMuted: { backgroundColor: t.colors.muted },\n paddingLg: { padding: spacing[4] },\n paddingMd: { padding: spacing[3] },\n paddingSm: { padding: spacing[2] },\n title: {\n borderBottomColor: t.colors.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n color: t.colors.foreground,\n fontFamily: t.typography.heading.fontFamily,\n fontSize: t.primitives.typography.base,\n fontWeight: fontWeights.semibold,\n lineHeight: t.typography.heading.lineHeight,\n marginBottom: spacing[2],\n paddingBottom: spacing[1] + 2,\n },\n });\n};\n\nexport const PdfCard = ({\n title,\n children,\n variant = \"default\",\n padding = \"md\",\n wrap = false,\n style,\n}: PdfCardProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createCardStyles(theme), [theme]);\n const paddingMap = {\n lg: styles.paddingLg,\n md: styles.paddingMd,\n sm: styles.paddingSm,\n };\n const cardStyles: Style[] = [styles.card];\n if (variant === \"bordered\") {\n cardStyles.push(styles.cardBordered);\n }\n if (variant === \"muted\") {\n cardStyles.push(styles.cardMuted);\n }\n cardStyles.push(paddingMap[padding]);\n if (style) {\n cardStyles.push(style);\n }\n return (\n <View wrap={wrap} style={cardStyles as never}>\n {title ? <PDFText style={styles.title}>{title}</PDFText> : null}\n {typeof children === \"string\" ? (\n <PDFText style={styles.body}>{children}</PDFText>\n ) : (\n children\n )}\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/card/card.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/data-table.json b/apps/web/public/r/forme/data-table.json
index a066c34..f38f444 100644
--- a/apps/web/public/r/forme/data-table.json
+++ b/apps/web/public/r/forme/data-table.json
@@ -14,22 +14,22 @@
"files": [
{
"path": "registry/bases/forme/components/data-table/data-table.styles.ts",
- "content": "import { StyleSheet } from \"@formepdf/react\";\r\n\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\n/**\r\n * Creates compact-mode cell and text styles for the DataTable component.\r\n * Used when `size=\"compact\"` to render denser rows with smaller font sizes.\r\n * @param t - The resolved PdfcnTheme instance.\r\n */\r\nexport const createCompactStyles = (t: PdfcnTheme) => {\r\n const { spacing, fontWeights, lineHeights } = t.primitives;\r\n return StyleSheet.create({\r\n cell: {\r\n paddingHorizontal: spacing[2],\r\n paddingVertical: spacing[0.5],\r\n },\r\n footerText: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n fontWeight: fontWeights.semibold,\r\n lineHeight: lineHeights.normal,\r\n },\r\n headerText: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n fontWeight: fontWeights.semibold,\r\n lineHeight: lineHeights.normal,\r\n },\r\n text: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n lineHeight: lineHeights.normal,\r\n },\r\n });\r\n};\r\n\r\n/**\r\n * Converts an arbitrary cell value to a display string.\r\n * Returns an empty string for null/undefined values.\r\n * @param value - The raw cell value to format.\r\n */\r\nexport const formatValue = (value: unknown): string => {\r\n if (value === null || value === undefined) {\r\n return \"\";\r\n }\r\n if (typeof value === \"number\") {\r\n return String(value);\r\n }\r\n return String(value);\r\n};\r\n",
+ "content": "import { StyleSheet } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\n/**\n * Creates compact-mode cell and text styles for the DataTable component.\n * Used when `size=\"compact\"` to render denser rows with smaller font sizes.\n * @param t - The resolved PdfcnTheme instance.\n */\nexport const createCompactStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights, lineHeights } = t.primitives;\n return StyleSheet.create({\n cell: {\n paddingHorizontal: spacing[2],\n paddingVertical: spacing[0.5],\n },\n footerText: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n fontWeight: fontWeights.semibold,\n lineHeight: lineHeights.normal,\n },\n headerText: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n fontWeight: fontWeights.semibold,\n lineHeight: lineHeights.normal,\n },\n text: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n lineHeight: lineHeights.normal,\n },\n });\n};\n\n/**\n * Converts an arbitrary cell value to a display string.\n * Returns an empty string for null/undefined values.\n * @param value - The raw cell value to format.\n */\nexport const formatValue = (value: unknown): string => {\n if (value === null || value === undefined) {\n return \"\";\n }\n if (typeof value === \"number\") {\n return String(value);\n }\n return String(value);\n};\n",
"type": "registry:component",
"target": "components/pdf/data-table/data-table.styles.ts"
},
{
"path": "registry/bases/forme/components/data-table/data-table.tsx",
- "content": "import { Fragment } from \"react\";\r\n\r\nimport {\r\n Table,\r\n TableBody,\r\n TableCell,\r\n TableFooter,\r\n TableHeader,\r\n TableRow,\r\n} from \"@/registry/bases/forme/components/table/table\";\r\nimport {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport { Text as PDFText } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\n\r\nimport { createCompactStyles, formatValue } from \"./data-table.styles\";\r\nimport type { DataTableProps } from \"./data-table.types\";\r\n\r\nexport const DataTable = <T extends Record<string, unknown>>({\r\n columns,\r\n data,\r\n variant = \"grid\",\r\n footer,\r\n stripe = false,\r\n size = \"default\",\r\n noWrap = false,\r\n style,\r\n}: DataTableProps<T>) => {\r\n const theme = usePdfcnTheme();\r\n const compact = useSafeMemo(() => createCompactStyles(theme), [theme]);\r\n const isCompact = size === \"compact\";\r\n\r\n return (\r\n <Table variant={variant} zebraStripe={stripe} noWrap={noWrap} style={style}>\r\n <TableHeader>\r\n <TableRow header>\r\n {columns.map((col) => (\r\n <TableCell\r\n key={col.key}\r\n header\r\n align={col.align ?? \"left\"}\r\n width={col.width}\r\n style={isCompact ? compact.cell : undefined}\r\n >\r\n {isCompact ? (\r\n <PDFText\r\n style={\r\n [\r\n compact.headerText,\r\n col.align ? ({ textAlign: col.align } as Style) : {},\r\n ] as never\r\n }\r\n >\r\n {col.header}\r\n </PDFText>\r\n ) : (\r\n col.header\r\n )}\r\n </TableCell>\r\n ))}\r\n </TableRow>\r\n </TableHeader>\r\n <TableBody>\r\n {data.map((row, i) => (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: DataTable has no row id; order is stable for static data\r\n <Fragment key={i}>\r\n <TableRow>\r\n {columns.map((col) => {\r\n const value = row[col.key];\r\n const rendered = col.render ? col.render(value, row) : null;\r\n const text = rendered === null ? formatValue(value) : null;\r\n return (\r\n <TableCell\r\n key={col.key}\r\n align={col.align ?? \"left\"}\r\n width={col.width}\r\n style={isCompact ? compact.cell : undefined}\r\n >\r\n {isCompact\r\n ? (rendered ?? (\r\n <PDFText\r\n style={\r\n [\r\n compact.text,\r\n col.align\r\n ? ({ textAlign: col.align } as Style)\r\n : {},\r\n ] as never\r\n }\r\n >\r\n {text}\r\n </PDFText>\r\n ))\r\n : (rendered ?? text)}\r\n </TableCell>\r\n );\r\n })}\r\n </TableRow>\r\n </Fragment>\r\n ))}\r\n </TableBody>\r\n {footer && (\r\n <TableFooter>\r\n <TableRow footer>\r\n {columns.map((col) => {\r\n const value = col.key in footer ? footer[col.key] : \"\";\r\n const rendered = col.renderFooter\r\n ? col.renderFooter(value)\r\n : null;\r\n const text = rendered === null ? formatValue(value) : null;\r\n return (\r\n <TableCell\r\n key={col.key}\r\n footer={!!value}\r\n align={col.align ?? \"left\"}\r\n width={col.width}\r\n style={isCompact ? compact.cell : undefined}\r\n >\r\n {isCompact\r\n ? (rendered ?? (\r\n <PDFText\r\n style={\r\n [\r\n value ? compact.footerText : compact.text,\r\n col.align\r\n ? ({ textAlign: col.align } as Style)\r\n : {},\r\n ] as never\r\n }\r\n >\r\n {text}\r\n </PDFText>\r\n ))\r\n : (rendered ?? text)}\r\n </TableCell>\r\n );\r\n })}\r\n </TableRow>\r\n </TableFooter>\r\n )}\r\n </Table>\r\n );\r\n};\r\n",
+ "content": "import { Fragment } from \"react\";\n\nimport {\n Table,\n TableBody,\n TableCell,\n TableFooter,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport { Text as PDFText } from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\n\nimport { createCompactStyles, formatValue } from \"./data-table.styles\";\nimport type { DataTableProps } from \"./data-table.types\";\n\nexport const DataTable = <T extends Record<string, unknown>>({\n columns,\n data,\n variant = \"grid\",\n footer,\n stripe = false,\n size = \"default\",\n noWrap = false,\n style,\n}: DataTableProps<T>) => {\n const theme = usePdfcnTheme();\n const compact = useSafeMemo(() => createCompactStyles(theme), [theme]);\n const isCompact = size === \"compact\";\n\n return (\n <Table variant={variant} zebraStripe={stripe} noWrap={noWrap} style={style}>\n <TableHeader>\n <TableRow header>\n {columns.map((col) => (\n <TableCell\n key={col.key}\n header\n align={col.align ?? \"left\"}\n width={col.width}\n style={isCompact ? compact.cell : undefined}\n >\n {isCompact ? (\n <PDFText\n style={\n [\n compact.headerText,\n col.align ? ({ textAlign: col.align } as Style) : {},\n ] as never\n }\n >\n {col.header}\n </PDFText>\n ) : (\n col.header\n )}\n </TableCell>\n ))}\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.map((row, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: DataTable has no row id; order is stable for static data\n <Fragment key={i}>\n <TableRow>\n {columns.map((col) => {\n const value = row[col.key];\n const rendered = col.render ? col.render(value, row) : null;\n const text = rendered === null ? formatValue(value) : null;\n return (\n <TableCell\n key={col.key}\n align={col.align ?? \"left\"}\n width={col.width}\n style={isCompact ? compact.cell : undefined}\n >\n {isCompact\n ? (rendered ?? (\n <PDFText\n style={\n [\n compact.text,\n col.align\n ? ({ textAlign: col.align } as Style)\n : {},\n ] as never\n }\n >\n {text}\n </PDFText>\n ))\n : (rendered ?? text)}\n </TableCell>\n );\n })}\n </TableRow>\n </Fragment>\n ))}\n </TableBody>\n {footer && (\n <TableFooter>\n <TableRow footer>\n {columns.map((col) => {\n const value = col.key in footer ? footer[col.key] : \"\";\n const rendered = col.renderFooter\n ? col.renderFooter(value)\n : null;\n const text = rendered === null ? formatValue(value) : null;\n return (\n <TableCell\n key={col.key}\n footer={!!value}\n align={col.align ?? \"left\"}\n width={col.width}\n style={isCompact ? compact.cell : undefined}\n >\n {isCompact\n ? (rendered ?? (\n <PDFText\n style={\n [\n value ? compact.footerText : compact.text,\n col.align\n ? ({ textAlign: col.align } as Style)\n : {},\n ] as never\n }\n >\n {text}\n </PDFText>\n ))\n : (rendered ?? text)}\n </TableCell>\n );\n })}\n </TableRow>\n </TableFooter>\n )}\n </Table>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/data-table/data-table.tsx"
},
{
"path": "registry/bases/forme/components/data-table/data-table.types.ts",
- "content": "import type React from \"react\";\r\n\r\nimport type { TableVariant } from \"@/registry/bases/forme/components/table/table.types\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\n\r\n/** DataTable row density size. */\r\nexport type DataTableSize = \"default\" | \"compact\";\r\n\r\n/**\r\n * Column definition for a DataTable.\r\n * Props - `key` | `header` | `align` | `width` | `render` | `renderFooter`\r\n * @see {@link DataTableColumn}\r\n */\r\nexport interface DataTableColumn<T = Record<string, unknown>> {\r\n key: keyof T & string;\r\n header: string;\r\n align?: \"left\" | \"center\" | \"right\";\r\n width?: string | number;\r\n /**\r\n * Custom cell renderer. Must return @formepdf/react elements (Text, View,\r\n * Image, etc.) — NOT HTML DOM elements. TypeScript accepts ReactNode but DOM\r\n * nodes will crash at runtime in the PDF renderer.\r\n */\r\n render?: (value: unknown, row: T) => React.ReactNode;\r\n /**\r\n * Custom footer cell renderer. Same constraint: return @formepdf/react\r\n * elements only — no HTML/DOM nodes.\r\n */\r\n renderFooter?: (value: unknown) => React.ReactNode;\r\n}\r\n\r\n/**\r\n * Data table for PDF rendering with column definitions, footer support, and stripe options.\r\n * Props - `columns` | `data` | `variant` | `footer` | `stripe` | `size` | `noWrap` | `style`\r\n * @see {@link DataTableProps}\r\n */\r\nexport interface DataTableProps<T = Record<string, unknown>> extends Omit<\r\n PDFComponentProps,\r\n \"children\"\r\n> {\r\n columns: DataTableColumn<T>[];\r\n data: T[];\r\n /**\r\n * @default 'grid'\r\n */\r\n variant?: TableVariant;\r\n footer?: Partial<Record<keyof T & string, string | number>>;\r\n stripe?: boolean;\r\n /**\r\n * @default 'default'\r\n */\r\n size?: DataTableSize;\r\n noWrap?: boolean;\r\n}\r\n",
+ "content": "import type React from \"react\";\n\nimport type { TableVariant } from \"@/components/pdf/table/table.types\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\n\n/** DataTable row density size. */\nexport type DataTableSize = \"default\" | \"compact\";\n\n/**\n * Column definition for a DataTable.\n * Props - `key` | `header` | `align` | `width` | `render` | `renderFooter`\n * @see {@link DataTableColumn}\n */\nexport interface DataTableColumn<T = Record<string, unknown>> {\n key: keyof T & string;\n header: string;\n align?: \"left\" | \"center\" | \"right\";\n width?: string | number;\n /**\n * Custom cell renderer. Must return @formepdf/react elements (Text, View,\n * Image, etc.) — NOT HTML DOM elements. TypeScript accepts ReactNode but DOM\n * nodes will crash at runtime in the PDF renderer.\n */\n render?: (value: unknown, row: T) => React.ReactNode;\n /**\n * Custom footer cell renderer. Same constraint: return @formepdf/react\n * elements only — no HTML/DOM nodes.\n */\n renderFooter?: (value: unknown) => React.ReactNode;\n}\n\n/**\n * Data table for PDF rendering with column definitions, footer support, and stripe options.\n * Props - `columns` | `data` | `variant` | `footer` | `stripe` | `size` | `noWrap` | `style`\n * @see {@link DataTableProps}\n */\nexport interface DataTableProps<T = Record<string, unknown>> extends Omit<\n PDFComponentProps,\n \"children\"\n> {\n columns: DataTableColumn<T>[];\n data: T[];\n /**\n * @default 'grid'\n */\n variant?: TableVariant;\n footer?: Partial<Record<keyof T & string, string | number>>;\n stripe?: boolean;\n /**\n * @default 'default'\n */\n size?: DataTableSize;\n noWrap?: boolean;\n}\n",
"type": "registry:component",
"target": "components/pdf/data-table/data-table.types.ts"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/divider.json b/apps/web/public/r/forme/divider.json
index 402524a..b811b17 100644
--- a/apps/web/public/r/forme/divider.json
+++ b/apps/web/public/r/forme/divider.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/forme/components/divider/divider.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport {\r\n Text as PDFText,\r\n StyleSheet,\r\n View,\r\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type DividerVariant = \"solid\" | \"dashed\" | \"dotted\";\r\nexport type DividerThickness = \"thin\" | \"medium\" | \"thick\";\r\nexport type DividerSpacing = \"none\" | \"sm\" | \"md\" | \"lg\";\r\n\r\n/**\r\n * Horizontal rule with optional label, style variants, and spacing presets.\r\n * Props - `spacing` | `variant` | `color` | `thickness` | `label` | `width` | `style`\r\n * @see {@link DividerProps}\r\n */\r\nexport interface DividerProps extends Omit<PDFComponentProps, \"children\"> {\r\n /**\r\n * @default 'md'\r\n */\r\n spacing?: DividerSpacing;\r\n /**\r\n * @default 'solid'\r\n */\r\n variant?: DividerVariant;\r\n color?: string;\r\n /**\r\n * @default 'thin'\r\n */\r\n thickness?: DividerThickness;\r\n label?: string;\r\n width?: string | number;\r\n}\r\n\r\nconst createDividerStyles = (t: PdfcnTheme) => {\r\n const { spacing, fontWeights } = t.primitives;\r\n return StyleSheet.create({\r\n base: { borderBottomColor: t.colors.border, borderBottomStyle: \"solid\" },\r\n dashed: { borderBottomStyle: \"dashed\" },\r\n dotted: { borderBottomStyle: \"dotted\" },\r\n labelContainer: { alignItems: \"center\", flexDirection: \"row\" },\r\n labelLine: {\r\n borderBottomColor: t.colors.border,\r\n borderBottomStyle: \"solid\",\r\n flex: 1,\r\n },\r\n labelText: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n fontWeight: fontWeights.medium,\r\n letterSpacing: t.primitives.letterSpacing.wider * 10,\r\n paddingHorizontal: spacing[3],\r\n textTransform: \"uppercase\",\r\n },\r\n medium: { borderBottomWidth: spacing[1] },\r\n solid: { borderBottomStyle: \"solid\" },\r\n spacingLg: { marginVertical: t.spacing.sectionGap },\r\n spacingMd: { marginVertical: t.spacing.componentGap },\r\n spacingNone: { marginVertical: spacing[0] },\r\n spacingSm: { marginVertical: t.spacing.paragraphGap },\r\n thick: { borderBottomWidth: spacing[2] },\r\n thin: { borderBottomWidth: spacing[0.5] },\r\n } as Record<string, Style>);\r\n};\r\n\r\nexport const Divider = ({\r\n spacing = \"md\",\r\n variant = \"solid\",\r\n color,\r\n thickness = \"thin\",\r\n label,\r\n width,\r\n style,\r\n}: DividerProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createDividerStyles(theme), [theme]);\r\n const spacingMap = {\r\n lg: styles.spacingLg,\r\n md: styles.spacingMd,\r\n none: styles.spacingNone,\r\n sm: styles.spacingSm,\r\n };\r\n const variantMap = {\r\n dashed: styles.dashed,\r\n dotted: styles.dotted,\r\n solid: styles.solid,\r\n };\r\n const thicknessMap = {\r\n medium: styles.medium,\r\n thick: styles.thick,\r\n thin: styles.thin,\r\n };\r\n\r\n if (label) {\r\n const lineStyle: Style[] = [\r\n styles.labelLine,\r\n thicknessMap[thickness],\r\n variantMap[variant],\r\n ];\r\n if (color) {\r\n lineStyle.push({\r\n borderBottomColor: resolveColor(color, theme.colors),\r\n } as Style);\r\n }\r\n const containerStyles: Style[] = [\r\n styles.labelContainer,\r\n spacingMap[spacing],\r\n ];\r\n if (width !== undefined) {\r\n containerStyles.push({ width } as Style);\r\n }\r\n if (style) {\r\n containerStyles.push(...[style].flat());\r\n }\r\n const labelTextStyle: Style[] = [styles.labelText];\r\n if (color) {\r\n labelTextStyle.push({ color: resolveColor(color, theme.colors) });\r\n }\r\n return (\r\n <View style={containerStyles as never}>\r\n <View style={lineStyle as never} />\r\n <PDFText style={labelTextStyle as never}>{label}</PDFText>\r\n <View style={lineStyle as never} />\r\n </View>\r\n );\r\n }\r\n\r\n const styleArray: Style[] = [\r\n styles.base,\r\n spacingMap[spacing],\r\n variantMap[variant],\r\n thicknessMap[thickness],\r\n ];\r\n if (color) {\r\n styleArray.push({ borderBottomColor: resolveColor(color, theme.colors) });\r\n }\r\n if (width !== undefined) {\r\n styleArray.push({ width } as Style);\r\n }\r\n if (style) {\r\n styleArray.push(...[style].flat());\r\n }\r\n return <View style={styleArray as never} />;\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type DividerVariant = \"solid\" | \"dashed\" | \"dotted\";\nexport type DividerThickness = \"thin\" | \"medium\" | \"thick\";\nexport type DividerSpacing = \"none\" | \"sm\" | \"md\" | \"lg\";\n\n/**\n * Horizontal rule with optional label, style variants, and spacing presets.\n * Props - `spacing` | `variant` | `color` | `thickness` | `label` | `width` | `style`\n * @see {@link DividerProps}\n */\nexport interface DividerProps extends Omit<PDFComponentProps, \"children\"> {\n /**\n * @default 'md'\n */\n spacing?: DividerSpacing;\n /**\n * @default 'solid'\n */\n variant?: DividerVariant;\n color?: string;\n /**\n * @default 'thin'\n */\n thickness?: DividerThickness;\n label?: string;\n width?: string | number;\n}\n\nconst createDividerStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights } = t.primitives;\n return StyleSheet.create({\n base: { borderBottomColor: t.colors.border, borderBottomStyle: \"solid\" },\n dashed: { borderBottomStyle: \"dashed\" },\n dotted: { borderBottomStyle: \"dotted\" },\n labelContainer: { alignItems: \"center\", flexDirection: \"row\" },\n labelLine: {\n borderBottomColor: t.colors.border,\n borderBottomStyle: \"solid\",\n flex: 1,\n },\n labelText: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n fontWeight: fontWeights.medium,\n letterSpacing: t.primitives.letterSpacing.wider * 10,\n paddingHorizontal: spacing[3],\n textTransform: \"uppercase\",\n },\n medium: { borderBottomWidth: spacing[1] },\n solid: { borderBottomStyle: \"solid\" },\n spacingLg: { marginVertical: t.spacing.sectionGap },\n spacingMd: { marginVertical: t.spacing.componentGap },\n spacingNone: { marginVertical: spacing[0] },\n spacingSm: { marginVertical: t.spacing.paragraphGap },\n thick: { borderBottomWidth: spacing[2] },\n thin: { borderBottomWidth: spacing[0.5] },\n } as Record<string, Style>);\n};\n\nexport const Divider = ({\n spacing = \"md\",\n variant = \"solid\",\n color,\n thickness = \"thin\",\n label,\n width,\n style,\n}: DividerProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createDividerStyles(theme), [theme]);\n const spacingMap = {\n lg: styles.spacingLg,\n md: styles.spacingMd,\n none: styles.spacingNone,\n sm: styles.spacingSm,\n };\n const variantMap = {\n dashed: styles.dashed,\n dotted: styles.dotted,\n solid: styles.solid,\n };\n const thicknessMap = {\n medium: styles.medium,\n thick: styles.thick,\n thin: styles.thin,\n };\n\n if (label) {\n const lineStyle: Style[] = [\n styles.labelLine,\n thicknessMap[thickness],\n variantMap[variant],\n ];\n if (color) {\n lineStyle.push({\n borderBottomColor: resolveColor(color, theme.colors),\n } as Style);\n }\n const containerStyles: Style[] = [\n styles.labelContainer,\n spacingMap[spacing],\n ];\n if (width !== undefined) {\n containerStyles.push({ width } as Style);\n }\n if (style) {\n containerStyles.push(...[style].flat());\n }\n const labelTextStyle: Style[] = [styles.labelText];\n if (color) {\n labelTextStyle.push({ color: resolveColor(color, theme.colors) });\n }\n return (\n <View style={containerStyles as never}>\n <View style={lineStyle as never} />\n <PDFText style={labelTextStyle as never}>{label}</PDFText>\n <View style={lineStyle as never} />\n </View>\n );\n }\n\n const styleArray: Style[] = [\n styles.base,\n spacingMap[spacing],\n variantMap[variant],\n thicknessMap[thickness],\n ];\n if (color) {\n styleArray.push({ borderBottomColor: resolveColor(color, theme.colors) });\n }\n if (width !== undefined) {\n styleArray.push({ width } as Style);\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return <View style={styleArray as never} />;\n};\n",
"type": "registry:component",
"target": "components/pdf/divider/divider.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/event-agenda.json b/apps/web/public/r/forme/event-agenda.json
index 35a5327..1608784 100644
--- a/apps/web/public/r/forme/event-agenda.json
+++ b/apps/web/public/r/forme/event-agenda.json
@@ -16,7 +16,7 @@
"files": [
{
"path": "registry/bases/forme/blocks/event-agenda/event-agenda.tsx",
- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { Section } from \"@/registry/bases/forme/components/section/section\";\nimport { Text } from \"@/registry/bases/forme/components/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type { EventAgendaProps, Session } from \"./event-agenda.types\";\nimport { sampleEventAgendaData } from \"./event-agenda.types\";\n\ninterface TimeSlotGroup {\n sessions: Session[];\n time: string;\n}\n\nconst groupSessionsByTime = (sessions: Session[]): TimeSlotGroup[] => {\n const groups: TimeSlotGroup[] = [];\n const map = new Map<string, Session[]>();\n\n for (const session of sessions) {\n const existing = map.get(session.time);\n if (existing) {\n existing.push(session);\n } else {\n const list = [session];\n map.set(session.time, list);\n groups.push({ sessions: list, time: session.time });\n }\n }\n\n return groups;\n};\n\nexport const EventAgendaContent = ({ data }: { data: EventAgendaProps }) => {\n const theme = usePdfcnTheme();\n const accent = data.accentColor ?? theme.colors.primary;\n\n const trackColorMap = new Map<string, string>();\n if (data.tracks) {\n for (const track of data.tracks) {\n trackColorMap.set(track.name.toLowerCase(), track.color);\n }\n }\n\n const styles = StyleSheet.create({\n breakBadge: {\n backgroundColor: theme.colors.muted,\n borderColor: theme.colors.border,\n borderRadius: 4,\n borderStyle: \"solid\",\n borderWidth: 1,\n paddingHorizontal: 6,\n paddingVertical: 2,\n },\n breakCard: {\n backgroundColor: theme.colors.muted,\n borderColor: theme.colors.border,\n borderRadius: 6,\n borderStyle: \"dashed\",\n borderWidth: 1,\n flex: 1,\n paddingHorizontal: 10,\n paddingVertical: 7,\n },\n dayBanner: {\n alignItems: \"center\",\n backgroundColor: theme.colors.muted,\n borderColor: theme.colors.border,\n borderRadius: 6,\n borderStyle: \"solid\",\n borderWidth: 1,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 10,\n marginTop: 8,\n paddingHorizontal: 12,\n paddingVertical: 6,\n },\n footerContainer: {\n borderTopColor: theme.colors.border,\n borderTopStyle: \"solid\",\n borderTopWidth: 1,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginTop: \"auto\",\n paddingTop: 8,\n },\n headerContainer: {\n borderBottomColor: theme.colors.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1.5,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: 10,\n },\n legendContainer: {\n alignItems: \"center\",\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 6,\n marginBottom: 8,\n },\n legendDot: {\n borderRadius: 3,\n height: 7,\n marginRight: 4,\n width: 7,\n },\n legendItem: {\n alignItems: \"center\",\n backgroundColor: theme.colors.muted,\n borderColor: theme.colors.border,\n borderRadius: 4,\n borderStyle: \"solid\",\n borderWidth: 1,\n flexDirection: \"row\",\n paddingHorizontal: 6,\n paddingVertical: 2,\n },\n pageContent: {\n backgroundColor: theme.colors.background,\n flex: 1,\n },\n roomBadge: {\n backgroundColor: theme.colors.muted,\n borderColor: theme.colors.border,\n borderRadius: 3,\n borderStyle: \"solid\",\n borderWidth: 1,\n paddingHorizontal: 5,\n paddingVertical: 1,\n },\n sessionCard: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: 6,\n borderStyle: \"solid\",\n borderWidth: 1,\n flex: 1,\n flexDirection: \"column\",\n paddingHorizontal: 10,\n paddingVertical: 7,\n },\n sessionsRow: {\n flex: 1,\n flexDirection: \"row\",\n gap: 8,\n },\n timeBox: {\n alignItems: \"flex-start\",\n flexDirection: \"column\",\n paddingTop: 2,\n width: 78,\n },\n timeSlotRow: {\n flexDirection: \"row\",\n marginBottom: 8,\n },\n trackBadge: {\n borderRadius: 3,\n paddingHorizontal: 6,\n paddingVertical: 1,\n },\n });\n\n return (\n <Document title={`${data.eventName} - Agenda`}>\n {data.days.map((day, dayIndex) => {\n const timeSlots = groupSessionsByTime(day.sessions);\n\n return (\n <Page\n key={day.label}\n size=\"A4\"\n margin={{ bottom: 32, left: 32, right: 32, top: 32 }}\n >\n <View style={styles.pageContent as never}>\n {/* Header */}\n <View style={styles.headerContainer as never}>\n <View style={{ flex: 1, paddingRight: 16 } as never}>\n <Text\n style={{\n color: accent,\n fontSize: 8.5,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n marginBottom: 2,\n textTransform: \"uppercase\",\n }}\n noMargin\n >\n Event Agenda\n </Text>\n <Text\n style={{\n fontSize: 20,\n fontWeight: \"bold\",\n lineHeight: 1.2,\n marginBottom: 4,\n }}\n noMargin\n >\n {data.eventName}\n </Text>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 8.5,\n }}\n noMargin\n >\n {data.date}\n {data.endDate ? ` – ${data.endDate}` : \"\"} • {data.venue}\n </Text>\n </View>\n\n <View\n style={\n {\n alignItems: \"flex-end\",\n justifyContent: \"center\",\n } as never\n }\n >\n <View\n style={\n {\n backgroundColor: accent,\n borderRadius: 4,\n paddingHorizontal: 10,\n paddingVertical: 4,\n } as never\n }\n >\n <Text\n style={{\n color: \"#ffffff\",\n fontSize: 10,\n fontWeight: \"bold\",\n letterSpacing: 0.8,\n textTransform: \"uppercase\",\n }}\n noMargin\n >\n AGENDA\n </Text>\n </View>\n </View>\n </View>\n\n {/* Day Title Banner */}\n <View style={styles.dayBanner as never}>\n <View\n style={\n {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 6,\n } as never\n }\n >\n <Text style={{ fontSize: 11, fontWeight: \"bold\" }} noMargin>\n {day.label}\n </Text>\n <Text\n style={{ color: theme.colors.mutedForeground, fontSize: 9 }}\n noMargin\n >\n — {day.date}\n </Text>\n </View>\n\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 8.5,\n fontWeight: 600,\n }}\n noMargin\n >\n Day {dayIndex + 1} of {data.days.length}\n </Text>\n </View>\n\n {/* Track Legend (if available) */}\n {data.tracks && data.tracks.length > 0 && (\n <View style={styles.legendContainer as never}>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.5,\n fontWeight: \"bold\",\n letterSpacing: 0.5,\n marginRight: 4,\n textTransform: \"uppercase\",\n }}\n noMargin\n >\n Tracks:\n </Text>\n {data.tracks.map((track) => (\n <View key={track.name} style={styles.legendItem as never}>\n <View\n style={\n [\n styles.legendDot,\n { backgroundColor: track.color },\n ] as never\n }\n />\n <Text style={{ fontSize: 7.5, fontWeight: 600 }} noMargin>\n {track.name}\n </Text>\n </View>\n ))}\n </View>\n )}\n\n {/* Sessions Time Grid */}\n <Section style={{ marginTop: 2 }}>\n {timeSlots.map((slot) => {\n const isSingleBreak =\n slot.sessions.length === 1 && slot.sessions[0].isBreak;\n\n return (\n <View key={slot.time} style={styles.timeSlotRow as never}>\n {/* Time Column */}\n <View style={styles.timeBox as never}>\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 9,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n {slot.time}\n </Text>\n {slot.sessions[0].endTime && (\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.5,\n }}\n noMargin\n >\n to {slot.sessions[0].endTime}\n </Text>\n )}\n </View>\n\n {/* Content Column */}\n {isSingleBreak ? (\n <View style={styles.breakCard as never}>\n <View\n style={\n {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n } as never\n }\n >\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 9.5,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n {slot.sessions[0].title}\n </Text>\n <View style={styles.breakBadge as never}>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7,\n fontWeight: \"bold\",\n letterSpacing: 0.5,\n textTransform: \"uppercase\",\n }}\n noMargin\n >\n Break\n </Text>\n </View>\n </View>\n {slot.sessions[0].description && (\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.5,\n marginTop: 2,\n }}\n noMargin\n >\n {slot.sessions[0].description}\n </Text>\n )}\n </View>\n ) : (\n <View style={styles.sessionsRow as never}>\n {slot.sessions.map((session, sIndex) => {\n const trackColor = session.track\n ? trackColorMap.get(session.track.toLowerCase())\n : undefined;\n\n return (\n <View\n key={`${session.title}-${sIndex}`}\n style={\n [\n styles.sessionCard,\n trackColor\n ? {\n borderLeftColor: trackColor,\n borderLeftWidth: 3,\n }\n : {},\n ] as never\n }\n >\n {/* Track & Room Metadata */}\n <View\n style={\n {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 4,\n marginBottom: 3,\n } as never\n }\n >\n {session.track && (\n <View\n style={\n [\n styles.trackBadge,\n {\n backgroundColor: trackColor\n ? `${trackColor}1A`\n : theme.colors.muted,\n },\n ] as never\n }\n >\n <Text\n style={{\n color:\n trackColor ??\n theme.colors.foreground,\n fontSize: 7,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n {session.track}\n </Text>\n </View>\n )}\n {session.room && (\n <View style={styles.roomBadge as never}>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7,\n fontWeight: 600,\n }}\n noMargin\n >\n {session.room}\n </Text>\n </View>\n )}\n </View>\n\n {/* Title */}\n <Text\n style={{\n fontSize: 9,\n fontWeight: \"bold\",\n lineHeight: 1.25,\n }}\n noMargin\n >\n {session.title}\n </Text>\n\n {/* Speaker */}\n {session.speaker && (\n <Text\n style={{\n color: accent,\n fontSize: 7.8,\n fontWeight: 600,\n marginTop: 2,\n }}\n noMargin\n >\n {session.speaker}\n </Text>\n )}\n\n {/* Description */}\n {session.description && (\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.2,\n lineHeight: 1.2,\n marginTop: 2,\n }}\n noMargin\n >\n {session.description}\n </Text>\n )}\n </View>\n );\n })}\n </View>\n )}\n </View>\n );\n })}\n </Section>\n\n {/* Footer */}\n <View style={styles.footerContainer as never}>\n <View style={{ flexDirection: \"column\", gap: 1 } as never}>\n {data.wifiInfo && (\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.5,\n fontWeight: 600,\n }}\n noMargin\n >\n Wi-Fi: {data.wifiInfo}\n </Text>\n )}\n {data.emergencyContact && (\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.2,\n }}\n noMargin\n >\n {data.emergencyContact}\n </Text>\n )}\n </View>\n\n <View style={{ alignItems: \"flex-end\" } as never}>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.5,\n fontWeight: 600,\n }}\n noMargin\n >\n Page {dayIndex + 1} of {data.days.length}\n </Text>\n </View>\n </View>\n </View>\n </Page>\n );\n })}\n </Document>\n );\n};\n\nexport const EventAgendaDocument = ({\n theme,\n data = sampleEventAgendaData,\n}: {\n theme?: PdfcnTheme;\n data?: EventAgendaProps;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <EventAgendaContent data={data} />\n </PdfcnThemeProvider>\n);\n\nexport { EventAgendaDocument as EventAgenda };\n",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { Section } from \"@/components/pdf/section/section\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { EventAgendaProps, Session } from \"./event-agenda.types\";\nimport { sampleEventAgendaData } from \"./event-agenda.types\";\n\ninterface TimeSlotGroup {\n sessions: Session[];\n time: string;\n}\n\nconst groupSessionsByTime = (sessions: Session[]): TimeSlotGroup[] => {\n const groups: TimeSlotGroup[] = [];\n const map = new Map<string, Session[]>();\n\n for (const session of sessions) {\n const existing = map.get(session.time);\n if (existing) {\n existing.push(session);\n } else {\n const list = [session];\n map.set(session.time, list);\n groups.push({ sessions: list, time: session.time });\n }\n }\n\n return groups;\n};\n\nexport const EventAgendaContent = ({ data }: { data: EventAgendaProps }) => {\n const theme = usePdfcnTheme();\n const accent = data.accentColor ?? theme.colors.primary;\n\n const trackColorMap = new Map<string, string>();\n if (data.tracks) {\n for (const track of data.tracks) {\n trackColorMap.set(track.name.toLowerCase(), track.color);\n }\n }\n\n const styles = StyleSheet.create({\n breakBadge: {\n backgroundColor: theme.colors.muted,\n borderColor: theme.colors.border,\n borderRadius: 4,\n borderStyle: \"solid\",\n borderWidth: 1,\n paddingHorizontal: 6,\n paddingVertical: 2,\n },\n breakCard: {\n backgroundColor: theme.colors.muted,\n borderColor: theme.colors.border,\n borderRadius: 6,\n borderStyle: \"dashed\",\n borderWidth: 1,\n flex: 1,\n paddingHorizontal: 10,\n paddingVertical: 7,\n },\n dayBanner: {\n alignItems: \"center\",\n backgroundColor: theme.colors.muted,\n borderColor: theme.colors.border,\n borderRadius: 6,\n borderStyle: \"solid\",\n borderWidth: 1,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 10,\n marginTop: 8,\n paddingHorizontal: 12,\n paddingVertical: 6,\n },\n footerContainer: {\n borderTopColor: theme.colors.border,\n borderTopStyle: \"solid\",\n borderTopWidth: 1,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginTop: \"auto\",\n paddingTop: 8,\n },\n headerContainer: {\n borderBottomColor: theme.colors.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1.5,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: 10,\n },\n legendContainer: {\n alignItems: \"center\",\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 6,\n marginBottom: 8,\n },\n legendDot: {\n borderRadius: 3,\n height: 7,\n marginRight: 4,\n width: 7,\n },\n legendItem: {\n alignItems: \"center\",\n backgroundColor: theme.colors.muted,\n borderColor: theme.colors.border,\n borderRadius: 4,\n borderStyle: \"solid\",\n borderWidth: 1,\n flexDirection: \"row\",\n paddingHorizontal: 6,\n paddingVertical: 2,\n },\n pageContent: {\n backgroundColor: theme.colors.background,\n flex: 1,\n },\n roomBadge: {\n backgroundColor: theme.colors.muted,\n borderColor: theme.colors.border,\n borderRadius: 3,\n borderStyle: \"solid\",\n borderWidth: 1,\n paddingHorizontal: 5,\n paddingVertical: 1,\n },\n sessionCard: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: 6,\n borderStyle: \"solid\",\n borderWidth: 1,\n flex: 1,\n flexDirection: \"column\",\n paddingHorizontal: 10,\n paddingVertical: 7,\n },\n sessionsRow: {\n flex: 1,\n flexDirection: \"row\",\n gap: 8,\n },\n timeBox: {\n alignItems: \"flex-start\",\n flexDirection: \"column\",\n paddingTop: 2,\n width: 78,\n },\n timeSlotRow: {\n flexDirection: \"row\",\n marginBottom: 8,\n },\n trackBadge: {\n borderRadius: 3,\n paddingHorizontal: 6,\n paddingVertical: 1,\n },\n });\n\n return (\n <Document title={`${data.eventName} - Agenda`}>\n {data.days.map((day, dayIndex) => {\n const timeSlots = groupSessionsByTime(day.sessions);\n\n return (\n <Page\n key={day.label}\n size=\"A4\"\n margin={{ bottom: 32, left: 32, right: 32, top: 32 }}\n >\n <View style={styles.pageContent as never}>\n {/* Header */}\n <View style={styles.headerContainer as never}>\n <View style={{ flex: 1, paddingRight: 16 } as never}>\n <Text\n style={{\n color: accent,\n fontSize: 8.5,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n marginBottom: 2,\n textTransform: \"uppercase\",\n }}\n noMargin\n >\n Event Agenda\n </Text>\n <Text\n style={{\n fontSize: 20,\n fontWeight: \"bold\",\n lineHeight: 1.2,\n marginBottom: 4,\n }}\n noMargin\n >\n {data.eventName}\n </Text>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 8.5,\n }}\n noMargin\n >\n {data.date}\n {data.endDate ? ` – ${data.endDate}` : \"\"} • {data.venue}\n </Text>\n </View>\n\n <View\n style={\n {\n alignItems: \"flex-end\",\n justifyContent: \"center\",\n } as never\n }\n >\n <View\n style={\n {\n backgroundColor: accent,\n borderRadius: 4,\n paddingHorizontal: 10,\n paddingVertical: 4,\n } as never\n }\n >\n <Text\n style={{\n color: \"#ffffff\",\n fontSize: 10,\n fontWeight: \"bold\",\n letterSpacing: 0.8,\n textTransform: \"uppercase\",\n }}\n noMargin\n >\n AGENDA\n </Text>\n </View>\n </View>\n </View>\n\n {/* Day Title Banner */}\n <View style={styles.dayBanner as never}>\n <View\n style={\n {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 6,\n } as never\n }\n >\n <Text style={{ fontSize: 11, fontWeight: \"bold\" }} noMargin>\n {day.label}\n </Text>\n <Text\n style={{ color: theme.colors.mutedForeground, fontSize: 9 }}\n noMargin\n >\n — {day.date}\n </Text>\n </View>\n\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 8.5,\n fontWeight: 600,\n }}\n noMargin\n >\n Day {dayIndex + 1} of {data.days.length}\n </Text>\n </View>\n\n {/* Track Legend (if available) */}\n {data.tracks && data.tracks.length > 0 && (\n <View style={styles.legendContainer as never}>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.5,\n fontWeight: \"bold\",\n letterSpacing: 0.5,\n marginRight: 4,\n textTransform: \"uppercase\",\n }}\n noMargin\n >\n Tracks:\n </Text>\n {data.tracks.map((track) => (\n <View key={track.name} style={styles.legendItem as never}>\n <View\n style={\n [\n styles.legendDot,\n { backgroundColor: track.color },\n ] as never\n }\n />\n <Text style={{ fontSize: 7.5, fontWeight: 600 }} noMargin>\n {track.name}\n </Text>\n </View>\n ))}\n </View>\n )}\n\n {/* Sessions Time Grid */}\n <Section style={{ marginTop: 2 }}>\n {timeSlots.map((slot) => {\n const isSingleBreak =\n slot.sessions.length === 1 && slot.sessions[0].isBreak;\n\n return (\n <View key={slot.time} style={styles.timeSlotRow as never}>\n {/* Time Column */}\n <View style={styles.timeBox as never}>\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 9,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n {slot.time}\n </Text>\n {slot.sessions[0].endTime && (\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.5,\n }}\n noMargin\n >\n to {slot.sessions[0].endTime}\n </Text>\n )}\n </View>\n\n {/* Content Column */}\n {isSingleBreak ? (\n <View style={styles.breakCard as never}>\n <View\n style={\n {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n } as never\n }\n >\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 9.5,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n {slot.sessions[0].title}\n </Text>\n <View style={styles.breakBadge as never}>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7,\n fontWeight: \"bold\",\n letterSpacing: 0.5,\n textTransform: \"uppercase\",\n }}\n noMargin\n >\n Break\n </Text>\n </View>\n </View>\n {slot.sessions[0].description && (\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.5,\n marginTop: 2,\n }}\n noMargin\n >\n {slot.sessions[0].description}\n </Text>\n )}\n </View>\n ) : (\n <View style={styles.sessionsRow as never}>\n {slot.sessions.map((session, sIndex) => {\n const trackColor = session.track\n ? trackColorMap.get(session.track.toLowerCase())\n : undefined;\n\n return (\n <View\n key={`${session.title}-${sIndex}`}\n style={\n [\n styles.sessionCard,\n trackColor\n ? {\n borderLeftColor: trackColor,\n borderLeftWidth: 3,\n }\n : {},\n ] as never\n }\n >\n {/* Track & Room Metadata */}\n <View\n style={\n {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 4,\n marginBottom: 3,\n } as never\n }\n >\n {session.track && (\n <View\n style={\n [\n styles.trackBadge,\n {\n backgroundColor: trackColor\n ? `${trackColor}1A`\n : theme.colors.muted,\n },\n ] as never\n }\n >\n <Text\n style={{\n color:\n trackColor ??\n theme.colors.foreground,\n fontSize: 7,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n {session.track}\n </Text>\n </View>\n )}\n {session.room && (\n <View style={styles.roomBadge as never}>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7,\n fontWeight: 600,\n }}\n noMargin\n >\n {session.room}\n </Text>\n </View>\n )}\n </View>\n\n {/* Title */}\n <Text\n style={{\n fontSize: 9,\n fontWeight: \"bold\",\n lineHeight: 1.25,\n }}\n noMargin\n >\n {session.title}\n </Text>\n\n {/* Speaker */}\n {session.speaker && (\n <Text\n style={{\n color: accent,\n fontSize: 7.8,\n fontWeight: 600,\n marginTop: 2,\n }}\n noMargin\n >\n {session.speaker}\n </Text>\n )}\n\n {/* Description */}\n {session.description && (\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.2,\n lineHeight: 1.2,\n marginTop: 2,\n }}\n noMargin\n >\n {session.description}\n </Text>\n )}\n </View>\n );\n })}\n </View>\n )}\n </View>\n );\n })}\n </Section>\n\n {/* Footer */}\n <View style={styles.footerContainer as never}>\n <View style={{ flexDirection: \"column\", gap: 1 } as never}>\n {data.wifiInfo && (\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.5,\n fontWeight: 600,\n }}\n noMargin\n >\n Wi-Fi: {data.wifiInfo}\n </Text>\n )}\n {data.emergencyContact && (\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.2,\n }}\n noMargin\n >\n {data.emergencyContact}\n </Text>\n )}\n </View>\n\n <View style={{ alignItems: \"flex-end\" } as never}>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.5,\n fontWeight: 600,\n }}\n noMargin\n >\n Page {dayIndex + 1} of {data.days.length}\n </Text>\n </View>\n </View>\n </View>\n </Page>\n );\n })}\n </Document>\n );\n};\n\nexport const EventAgendaDocument = ({\n theme,\n data = sampleEventAgendaData,\n}: {\n theme?: PdfcnTheme;\n data?: EventAgendaProps;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <EventAgendaContent data={data} />\n </PdfcnThemeProvider>\n);\n\nexport { EventAgendaDocument as EventAgenda };\n",
"type": "registry:block",
"target": "components/pdf/blocks/event-agenda/event-agenda.tsx"
},
@@ -28,4 +28,4 @@
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/event-ticket.json b/apps/web/public/r/forme/event-ticket.json
index eaaa2cb..98ad125 100644
--- a/apps/web/public/r/forme/event-ticket.json
+++ b/apps/web/public/r/forme/event-ticket.json
@@ -17,7 +17,7 @@
"files": [
{
"path": "registry/bases/forme/blocks/event-ticket/event-ticket.tsx",
- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { PdfImage } from \"@/registry/bases/forme/components/pdf-image/pdf-image\";\nimport { PdfQRCode } from \"@/registry/bases/forme/components/qrcode/qrcode\";\nimport { Text } from \"@/registry/bases/forme/components/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type { EventTicketData } from \"./event-ticket.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: EventTicketData = {\n accentColor: \"#52525b\",\n address: \"123 Main St, Las Vegas, NV\",\n doorsOpen: \"8:00 AM\",\n eventDate: \"May 15, 2026\",\n eventName: \"ShadCN Labs Conf\",\n eventTime: \"9:00 AM\",\n logoUrl: \"/favicon.png\",\n organizer: \"ShadCN Labs\",\n seat: { number: \"12\", row: \"3\", section: \"A\" },\n socialLinks: [\n { platform: \"X\", url: \"x.com/shadcn\" },\n { platform: \"Instagram\", url: \"instagram.com/shadcn\" },\n ],\n terms: \"Ticket is non-transferable. All sales final. No re-entry.\",\n ticketNumber: \"TKT-00142\",\n ticketType: \"VIP\",\n venue: \"Convention Center\",\n};\n\n// Standard event ticket, 7\" x 3.5\", expressed in PDF points (72 dpi)\nconst TICKET_SIZE = { height: 252, width: 504 };\n\nconst STUB_WIDTH = 120;\n\nconst STRIPE_WIDTH = 8;\n\nconst NOTCH_RADIUS = 8;\n\n// Forme renders neither dashed borders nor dashed SVG strokes, so the\n// perforation is painted as a stack of short dashes along the stub seam.\nconst PERFORATION_WIDTH = 1.5;\n\nconst PERFORATION_DASH = 4;\n\nconst PERFORATION_GAP = 3;\n\nconst perforationOffsets: number[] = [];\nfor (\n let offset = 0;\n offset < TICKET_SIZE.height;\n offset += PERFORATION_DASH + PERFORATION_GAP\n) {\n perforationOffsets.push(offset);\n}\n\nconst hexRgb = (color: string): [number, number, number] | null => {\n const hex = color.trim().replace(/^#/, \"\");\n\n if (/^[0-9a-f]{3}$/i.test(hex)) {\n return [\n Number.parseInt(hex[0] + hex[0], 16),\n Number.parseInt(hex[1] + hex[1], 16),\n Number.parseInt(hex[2] + hex[2], 16),\n ];\n }\n\n if (/^[0-9a-f]{6}([0-9a-f]{2})?$/i.test(hex)) {\n return [\n Number.parseInt(hex.slice(0, 2), 16),\n Number.parseInt(hex.slice(2, 4), 16),\n Number.parseInt(hex.slice(4, 6), 16),\n ];\n }\n\n return null;\n};\n\nconst inkOnAccent = (accent: string, light: string, dark: string) => {\n const rgb = hexRgb(accent);\n\n if (!rgb) {\n return dark;\n }\n\n const [r, g, b] = rgb;\n const luminance = (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;\n\n return luminance > 0.55 ? dark : light;\n};\n\nconst socialHandle = (url: string) => {\n const clean = url\n .replace(/^https?:\\/\\//i, \"\")\n .replace(/^www\\./i, \"\")\n .replace(/\\/$/, \"\");\n const parts = clean.split(\"/\").filter(Boolean);\n const handle = parts.at(-1);\n\n if (parts.length > 1 && handle) {\n return handle.startsWith(\"@\") ? handle : `@${handle}`;\n }\n\n return clean;\n};\n\nconst EventTicketContent = ({ data }: { data: EventTicketData }) => {\n const theme = usePdfcnTheme();\n const paper = theme.colors.background;\n const ink = theme.colors.foreground;\n const quiet = theme.colors.mutedForeground;\n\n const accent = resolveColor(\n data.accentColor ?? theme.colors.primary,\n theme.colors\n );\n const onAccent = inkOnAccent(accent, paper, ink);\n\n const styles = StyleSheet.create({\n admit: {\n color: onAccent,\n fontSize: 7,\n fontWeight: \"bold\",\n letterSpacing: 2,\n textTransform: \"uppercase\",\n },\n body: {\n flex: 1,\n height: TICKET_SIZE.height,\n justifyContent: \"space-between\",\n paddingBottom: 16,\n paddingLeft: 20,\n paddingRight: 18,\n paddingTop: 18,\n },\n brand: {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 8,\n marginBottom: 14,\n },\n fact: {\n flexShrink: 1,\n minWidth: 0,\n paddingRight: 12,\n },\n facts: {\n flexDirection: \"row\",\n },\n footer: {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 12,\n marginTop: 10,\n },\n label: {\n color: quiet,\n fontSize: 7,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n marginBottom: 3,\n textTransform: \"uppercase\",\n },\n logo: { borderRadius: 3, height: 14, width: 14 },\n notchBottom: {\n backgroundColor: paper,\n borderRadius: NOTCH_RADIUS,\n bottom: -NOTCH_RADIUS,\n height: NOTCH_RADIUS * 2,\n left: TICKET_SIZE.width - STUB_WIDTH - NOTCH_RADIUS,\n position: \"absolute\",\n width: NOTCH_RADIUS * 2,\n },\n notchTop: {\n backgroundColor: paper,\n borderRadius: NOTCH_RADIUS,\n height: NOTCH_RADIUS * 2,\n left: TICKET_SIZE.width - STUB_WIDTH - NOTCH_RADIUS,\n position: \"absolute\",\n top: -NOTCH_RADIUS,\n width: NOTCH_RADIUS * 2,\n },\n organizer: {\n color: quiet,\n // Forme ignores `marginLeft: \"auto\"`, so the organizer line absorbs the\n // free space and pushes the ticket-type pill to the right edge.\n flexGrow: 1,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 1.1,\n textTransform: \"uppercase\",\n },\n page: {\n alignItems: \"stretch\",\n backgroundColor: paper,\n flexDirection: \"row\",\n height: TICKET_SIZE.height,\n overflow: \"hidden\",\n position: \"relative\",\n width: TICKET_SIZE.width,\n },\n perforation: {\n height: TICKET_SIZE.height,\n left: TICKET_SIZE.width - STUB_WIDTH - PERFORATION_WIDTH / 2,\n position: \"absolute\",\n top: 0,\n width: PERFORATION_WIDTH,\n },\n perforationDash: {\n backgroundColor: paper,\n height: PERFORATION_DASH,\n marginBottom: PERFORATION_GAP,\n width: PERFORATION_WIDTH,\n },\n pill: {\n backgroundColor: accent,\n borderRadius: 9,\n paddingHorizontal: 8,\n paddingVertical: 3,\n },\n pillText: {\n color: onAccent,\n fontSize: 7,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n textTransform: \"uppercase\",\n },\n qr: {\n backgroundColor: \"#ffffff\",\n borderRadius: 6,\n padding: 5,\n },\n serial: {\n color: onAccent,\n fontSize: 7,\n fontWeight: \"bold\",\n letterSpacing: 1.1,\n textTransform: \"uppercase\",\n },\n socialItem: {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 4,\n },\n socialLabel: {\n color: quiet,\n fontSize: 6.5,\n fontWeight: \"bold\",\n letterSpacing: 0.4,\n textTransform: \"uppercase\",\n },\n socialList: {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 8,\n },\n socialValue: {\n color: quiet,\n fontSize: 6.5,\n },\n stripe: {\n backgroundColor: accent,\n height: TICKET_SIZE.height,\n width: STRIPE_WIDTH,\n },\n stub: {\n alignItems: \"center\",\n backgroundColor: accent,\n height: TICKET_SIZE.height,\n justifyContent: \"space-between\",\n paddingBottom: 14,\n paddingHorizontal: 12,\n paddingTop: 16,\n width: STUB_WIDTH,\n },\n terms: {\n color: quiet,\n flex: 1,\n fontSize: 6.5,\n lineHeight: 1.4,\n paddingRight: 8,\n },\n title: {\n color: ink,\n fontSize: 26,\n fontWeight: \"bold\",\n letterSpacing: -0.6,\n lineHeight: 1.08,\n marginBottom: 8,\n },\n value: {\n color: ink,\n fontSize: 12,\n fontWeight: \"bold\",\n },\n venue: {\n color: quiet,\n fontSize: 10,\n lineHeight: 1.4,\n },\n });\n\n return (\n <Document title={`${data.eventName} ${data.ticketNumber}`}>\n <Page margin={0} size={TICKET_SIZE}>\n <View style={styles.page as never}>\n <View style={styles.stripe} />\n\n <View style={styles.body}>\n <View>\n <View style={styles.brand}>\n {data.logoUrl && (\n <PdfImage\n fit=\"contain\"\n src={data.logoUrl}\n style={styles.logo}\n />\n )}\n <Text noMargin style={styles.organizer}>\n {data.organizer ?? \"Event ticket\"}\n </Text>\n <View style={styles.pill}>\n <Text noMargin style={styles.pillText}>\n {data.ticketType}\n </Text>\n </View>\n </View>\n <Text noMargin style={styles.title}>\n {data.eventName}\n </Text>\n <Text noMargin style={styles.venue}>\n {data.venue}\n </Text>\n <Text noMargin style={styles.venue}>\n {data.address}\n </Text>\n </View>\n\n <View>\n <View style={styles.facts}>\n <View style={styles.fact}>\n <Text noMargin style={styles.label}>\n Date\n </Text>\n <Text noMargin style={styles.value}>\n {data.eventDate}\n </Text>\n </View>\n <View style={styles.fact}>\n <Text noMargin style={styles.label}>\n Time\n </Text>\n <Text noMargin style={styles.value}>\n {data.eventTime}\n </Text>\n </View>\n {data.doorsOpen && (\n <View style={styles.fact}>\n <Text noMargin style={styles.label}>\n Doors\n </Text>\n <Text noMargin style={styles.value}>\n {data.doorsOpen}\n </Text>\n </View>\n )}\n {data.seat && (\n <View style={styles.fact}>\n <Text noMargin style={styles.label}>\n Seat\n </Text>\n <Text noMargin style={styles.value}>\n {`${data.seat.section}–${data.seat.row}–${data.seat.number}`}\n </Text>\n </View>\n )}\n </View>\n {(data.terms ||\n (data.socialLinks && data.socialLinks.length > 0)) && (\n <View style={styles.footer}>\n {data.terms && (\n <Text noMargin style={styles.terms}>\n {data.terms}\n </Text>\n )}\n {data.socialLinks && data.socialLinks.length > 0 && (\n <View style={styles.socialList}>\n {data.socialLinks.map((link) => (\n <View\n key={`${link.platform}-${link.url}`}\n style={styles.socialItem}\n >\n <Text noMargin style={styles.socialLabel}>\n {link.platform}\n </Text>\n <Text noMargin style={styles.socialValue}>\n {socialHandle(link.url)}\n </Text>\n </View>\n ))}\n </View>\n )}\n </View>\n )}\n </View>\n </View>\n\n <View style={styles.stub}>\n <Text noMargin style={styles.admit}>\n Admit one\n </Text>\n <View style={styles.qr}>\n {data.qrCodeUrl ? (\n <PdfImage\n fit=\"contain\"\n height={68}\n src={data.qrCodeUrl}\n width={68}\n />\n ) : (\n <PdfQRCode\n backgroundColor=\"#ffffff\"\n color=\"#000000\"\n size={68}\n value={data.ticketNumber}\n />\n )}\n </View>\n <Text noMargin style={styles.serial}>\n {data.ticketNumber}\n </Text>\n </View>\n\n <View style={styles.perforation}>\n {perforationOffsets.map((offset) => (\n <View\n key={`perforation-${offset}`}\n style={styles.perforationDash}\n />\n ))}\n </View>\n\n <View style={styles.notchTop} />\n <View style={styles.notchBottom} />\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const EventTicketDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: EventTicketData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <EventTicketContent data={data} />\n </PdfcnThemeProvider>\n);\n",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { PdfImage } from \"@/components/pdf/pdf-image/pdf-image\";\nimport { PdfQRCode } from \"@/components/pdf/qrcode/qrcode\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { EventTicketData } from \"./event-ticket.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: EventTicketData = {\n accentColor: \"#52525b\",\n address: \"123 Main St, Las Vegas, NV\",\n doorsOpen: \"8:00 AM\",\n eventDate: \"May 15, 2026\",\n eventName: \"ShadCN Labs Conf\",\n eventTime: \"9:00 AM\",\n logoUrl: \"/favicon.png\",\n organizer: \"ShadCN Labs\",\n seat: { number: \"12\", row: \"3\", section: \"A\" },\n socialLinks: [\n { platform: \"X\", url: \"x.com/shadcn\" },\n { platform: \"Instagram\", url: \"instagram.com/shadcn\" },\n ],\n terms: \"Ticket is non-transferable. All sales final. No re-entry.\",\n ticketNumber: \"TKT-00142\",\n ticketType: \"VIP\",\n venue: \"Convention Center\",\n};\n\n// Standard event ticket, 7\" x 3.5\", expressed in PDF points (72 dpi)\nconst TICKET_SIZE = { height: 252, width: 504 };\n\nconst STUB_WIDTH = 120;\n\nconst STRIPE_WIDTH = 8;\n\nconst NOTCH_RADIUS = 8;\n\n// Forme renders neither dashed borders nor dashed SVG strokes, so the\n// perforation is painted as a stack of short dashes along the stub seam.\nconst PERFORATION_WIDTH = 1.5;\n\nconst PERFORATION_DASH = 4;\n\nconst PERFORATION_GAP = 3;\n\nconst perforationOffsets: number[] = [];\nfor (\n let offset = 0;\n offset < TICKET_SIZE.height;\n offset += PERFORATION_DASH + PERFORATION_GAP\n) {\n perforationOffsets.push(offset);\n}\n\nconst hexRgb = (color: string): [number, number, number] | null => {\n const hex = color.trim().replace(/^#/, \"\");\n\n if (/^[0-9a-f]{3}$/i.test(hex)) {\n return [\n Number.parseInt(hex[0] + hex[0], 16),\n Number.parseInt(hex[1] + hex[1], 16),\n Number.parseInt(hex[2] + hex[2], 16),\n ];\n }\n\n if (/^[0-9a-f]{6}([0-9a-f]{2})?$/i.test(hex)) {\n return [\n Number.parseInt(hex.slice(0, 2), 16),\n Number.parseInt(hex.slice(2, 4), 16),\n Number.parseInt(hex.slice(4, 6), 16),\n ];\n }\n\n return null;\n};\n\nconst inkOnAccent = (accent: string, light: string, dark: string) => {\n const rgb = hexRgb(accent);\n\n if (!rgb) {\n return dark;\n }\n\n const [r, g, b] = rgb;\n const luminance = (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;\n\n return luminance > 0.55 ? dark : light;\n};\n\nconst socialHandle = (url: string) => {\n const clean = url\n .replace(/^https?:\\/\\//i, \"\")\n .replace(/^www\\./i, \"\")\n .replace(/\\/$/, \"\");\n const parts = clean.split(\"/\").filter(Boolean);\n const handle = parts.at(-1);\n\n if (parts.length > 1 && handle) {\n return handle.startsWith(\"@\") ? handle : `@${handle}`;\n }\n\n return clean;\n};\n\nconst EventTicketContent = ({ data }: { data: EventTicketData }) => {\n const theme = usePdfcnTheme();\n const paper = theme.colors.background;\n const ink = theme.colors.foreground;\n const quiet = theme.colors.mutedForeground;\n\n const accent = resolveColor(\n data.accentColor ?? theme.colors.primary,\n theme.colors\n );\n const onAccent = inkOnAccent(accent, paper, ink);\n\n const styles = StyleSheet.create({\n admit: {\n color: onAccent,\n fontSize: 7,\n fontWeight: \"bold\",\n letterSpacing: 2,\n textTransform: \"uppercase\",\n },\n body: {\n flex: 1,\n height: TICKET_SIZE.height,\n justifyContent: \"space-between\",\n paddingBottom: 16,\n paddingLeft: 20,\n paddingRight: 18,\n paddingTop: 18,\n },\n brand: {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 8,\n marginBottom: 14,\n },\n fact: {\n flexShrink: 1,\n minWidth: 0,\n paddingRight: 12,\n },\n facts: {\n flexDirection: \"row\",\n },\n footer: {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 12,\n marginTop: 10,\n },\n label: {\n color: quiet,\n fontSize: 7,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n marginBottom: 3,\n textTransform: \"uppercase\",\n },\n logo: { borderRadius: 3, height: 14, width: 14 },\n notchBottom: {\n backgroundColor: paper,\n borderRadius: NOTCH_RADIUS,\n bottom: -NOTCH_RADIUS,\n height: NOTCH_RADIUS * 2,\n left: TICKET_SIZE.width - STUB_WIDTH - NOTCH_RADIUS,\n position: \"absolute\",\n width: NOTCH_RADIUS * 2,\n },\n notchTop: {\n backgroundColor: paper,\n borderRadius: NOTCH_RADIUS,\n height: NOTCH_RADIUS * 2,\n left: TICKET_SIZE.width - STUB_WIDTH - NOTCH_RADIUS,\n position: \"absolute\",\n top: -NOTCH_RADIUS,\n width: NOTCH_RADIUS * 2,\n },\n organizer: {\n color: quiet,\n // Forme ignores `marginLeft: \"auto\"`, so the organizer line absorbs the\n // free space and pushes the ticket-type pill to the right edge.\n flexGrow: 1,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 1.1,\n textTransform: \"uppercase\",\n },\n page: {\n alignItems: \"stretch\",\n backgroundColor: paper,\n flexDirection: \"row\",\n height: TICKET_SIZE.height,\n overflow: \"hidden\",\n position: \"relative\",\n width: TICKET_SIZE.width,\n },\n perforation: {\n height: TICKET_SIZE.height,\n left: TICKET_SIZE.width - STUB_WIDTH - PERFORATION_WIDTH / 2,\n position: \"absolute\",\n top: 0,\n width: PERFORATION_WIDTH,\n },\n perforationDash: {\n backgroundColor: paper,\n height: PERFORATION_DASH,\n marginBottom: PERFORATION_GAP,\n width: PERFORATION_WIDTH,\n },\n pill: {\n backgroundColor: accent,\n borderRadius: 9,\n paddingHorizontal: 8,\n paddingVertical: 3,\n },\n pillText: {\n color: onAccent,\n fontSize: 7,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n textTransform: \"uppercase\",\n },\n qr: {\n backgroundColor: \"#ffffff\",\n borderRadius: 6,\n padding: 5,\n },\n serial: {\n color: onAccent,\n fontSize: 7,\n fontWeight: \"bold\",\n letterSpacing: 1.1,\n textTransform: \"uppercase\",\n },\n socialItem: {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 4,\n },\n socialLabel: {\n color: quiet,\n fontSize: 6.5,\n fontWeight: \"bold\",\n letterSpacing: 0.4,\n textTransform: \"uppercase\",\n },\n socialList: {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 8,\n },\n socialValue: {\n color: quiet,\n fontSize: 6.5,\n },\n stripe: {\n backgroundColor: accent,\n height: TICKET_SIZE.height,\n width: STRIPE_WIDTH,\n },\n stub: {\n alignItems: \"center\",\n backgroundColor: accent,\n height: TICKET_SIZE.height,\n justifyContent: \"space-between\",\n paddingBottom: 14,\n paddingHorizontal: 12,\n paddingTop: 16,\n width: STUB_WIDTH,\n },\n terms: {\n color: quiet,\n flex: 1,\n fontSize: 6.5,\n lineHeight: 1.4,\n paddingRight: 8,\n },\n title: {\n color: ink,\n fontSize: 26,\n fontWeight: \"bold\",\n letterSpacing: -0.6,\n lineHeight: 1.08,\n marginBottom: 8,\n },\n value: {\n color: ink,\n fontSize: 12,\n fontWeight: \"bold\",\n },\n venue: {\n color: quiet,\n fontSize: 10,\n lineHeight: 1.4,\n },\n });\n\n return (\n <Document title={`${data.eventName} ${data.ticketNumber}`}>\n <Page margin={0} size={TICKET_SIZE}>\n <View style={styles.page as never}>\n <View style={styles.stripe} />\n\n <View style={styles.body}>\n <View>\n <View style={styles.brand}>\n {data.logoUrl && (\n <PdfImage\n fit=\"contain\"\n src={data.logoUrl}\n style={styles.logo}\n />\n )}\n <Text noMargin style={styles.organizer}>\n {data.organizer ?? \"Event ticket\"}\n </Text>\n <View style={styles.pill}>\n <Text noMargin style={styles.pillText}>\n {data.ticketType}\n </Text>\n </View>\n </View>\n <Text noMargin style={styles.title}>\n {data.eventName}\n </Text>\n <Text noMargin style={styles.venue}>\n {data.venue}\n </Text>\n <Text noMargin style={styles.venue}>\n {data.address}\n </Text>\n </View>\n\n <View>\n <View style={styles.facts}>\n <View style={styles.fact}>\n <Text noMargin style={styles.label}>\n Date\n </Text>\n <Text noMargin style={styles.value}>\n {data.eventDate}\n </Text>\n </View>\n <View style={styles.fact}>\n <Text noMargin style={styles.label}>\n Time\n </Text>\n <Text noMargin style={styles.value}>\n {data.eventTime}\n </Text>\n </View>\n {data.doorsOpen && (\n <View style={styles.fact}>\n <Text noMargin style={styles.label}>\n Doors\n </Text>\n <Text noMargin style={styles.value}>\n {data.doorsOpen}\n </Text>\n </View>\n )}\n {data.seat && (\n <View style={styles.fact}>\n <Text noMargin style={styles.label}>\n Seat\n </Text>\n <Text noMargin style={styles.value}>\n {`${data.seat.section}–${data.seat.row}–${data.seat.number}`}\n </Text>\n </View>\n )}\n </View>\n {(data.terms ||\n (data.socialLinks && data.socialLinks.length > 0)) && (\n <View style={styles.footer}>\n {data.terms && (\n <Text noMargin style={styles.terms}>\n {data.terms}\n </Text>\n )}\n {data.socialLinks && data.socialLinks.length > 0 && (\n <View style={styles.socialList}>\n {data.socialLinks.map((link) => (\n <View\n key={`${link.platform}-${link.url}`}\n style={styles.socialItem}\n >\n <Text noMargin style={styles.socialLabel}>\n {link.platform}\n </Text>\n <Text noMargin style={styles.socialValue}>\n {socialHandle(link.url)}\n </Text>\n </View>\n ))}\n </View>\n )}\n </View>\n )}\n </View>\n </View>\n\n <View style={styles.stub}>\n <Text noMargin style={styles.admit}>\n Admit one\n </Text>\n <View style={styles.qr}>\n {data.qrCodeUrl ? (\n <PdfImage\n fit=\"contain\"\n height={68}\n src={data.qrCodeUrl}\n width={68}\n />\n ) : (\n <PdfQRCode\n backgroundColor=\"#ffffff\"\n color=\"#000000\"\n size={68}\n value={data.ticketNumber}\n />\n )}\n </View>\n <Text noMargin style={styles.serial}>\n {data.ticketNumber}\n </Text>\n </View>\n\n <View style={styles.perforation}>\n {perforationOffsets.map((offset) => (\n <View\n key={`perforation-${offset}`}\n style={styles.perforationDash}\n />\n ))}\n </View>\n\n <View style={styles.notchTop} />\n <View style={styles.notchBottom} />\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const EventTicketDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: EventTicketData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <EventTicketContent data={data} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/event-ticket/event-ticket.tsx"
},
@@ -29,4 +29,4 @@
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/form.json b/apps/web/public/r/forme/form.json
index 050eab2..25fefdf 100644
--- a/apps/web/public/r/forme/form.json
+++ b/apps/web/public/r/forme/form.json
@@ -13,22 +13,22 @@
"files": [
{
"path": "registry/bases/forme/components/form/form.styles.ts",
- "content": "import { StyleSheet } from \"@formepdf/react\";\r\n\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { PdfFormVariant } from \"./form.types\";\r\n\r\n/** Style factory for fillable form layouts, derived from the active theme. */\r\nexport const createFormStyles = (\r\n t: PdfcnTheme,\r\n variant: PdfFormVariant = \"underline\"\r\n) => {\r\n const { spacing, borderRadius, fontWeights, typography } = t.primitives;\r\n const borderColor = t.colors.border;\r\n // lighter than spacing[0.5]=2pt — more refined\r\n const hairline = 0.75;\r\n // group title rule\r\n const rule = 1;\r\n\r\n const fieldAreaByVariant: Record<PdfFormVariant, object> = {\r\n box: {\r\n borderColor,\r\n borderRadius: borderRadius.sm,\r\n borderStyle: \"solid\",\r\n borderWidth: hairline,\r\n },\r\n ghost: {\r\n backgroundColor: t.colors.muted,\r\n borderRadius: borderRadius.sm,\r\n },\r\n outlined: {\r\n borderColor: t.colors.foreground,\r\n borderRadius: borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: hairline,\r\n },\r\n underline: {\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: 1,\r\n },\r\n };\r\n\r\n const hasPadding =\r\n variant === \"box\" || variant === \"outlined\" || variant === \"ghost\";\r\n\r\n return StyleSheet.create({\r\n column: {\r\n flex: 1,\r\n },\r\n\r\n columnsRow: {\r\n flexDirection: \"row\",\r\n gap: spacing[4],\r\n },\r\n fieldAbove: {\r\n marginBottom: spacing[3],\r\n width: \"100%\",\r\n },\r\n fieldArea: {\r\n width: \"100%\" as const,\r\n ...fieldAreaByVariant[variant],\r\n },\r\n\r\n fieldLeft: {\r\n alignItems: \"flex-end\",\r\n flexDirection: \"row\",\r\n gap: spacing[2],\r\n marginBottom: spacing[3],\r\n },\r\n fieldLeftArea: {\r\n flex: 1,\r\n },\r\n\r\n formDivider: {\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: rule,\r\n marginBottom: spacing[4],\r\n },\r\n formSubtitle: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.sm,\r\n lineHeight: t.typography.body.lineHeight,\r\n marginBottom: spacing[3],\r\n },\r\n\r\n formTitle: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.heading.fontFamily,\r\n fontSize: typography.xl,\r\n fontWeight: fontWeights.bold,\r\n lineHeight: t.typography.heading.lineHeight,\r\n marginBottom: spacing[1],\r\n },\r\n group: {\r\n marginBottom: spacing[5],\r\n },\r\n\r\n groupTitle: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.xs,\r\n fontWeight: fontWeights.semibold,\r\n letterSpacing: 0.8,\r\n lineHeight: 1.2,\r\n marginBottom: spacing[3],\r\n textTransform: \"uppercase\",\r\n },\r\n hint: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.xs,\r\n opacity: 0.14,\r\n paddingBottom: hasPadding ? spacing[1] : 0,\r\n paddingHorizontal: hasPadding ? spacing[2] : 0,\r\n paddingTop: hasPadding ? spacing[1] : spacing[0.5],\r\n },\r\n labelAbove: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.xs,\r\n fontWeight: fontWeights.medium,\r\n letterSpacing: 0.5,\r\n lineHeight: 1.2,\r\n marginBottom: spacing[1],\r\n textTransform: \"uppercase\",\r\n },\r\n\r\n labelLeft: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n fontWeight: fontWeights.medium,\r\n lineHeight: t.typography.body.lineHeight,\r\n paddingBottom: hasPadding ? spacing[1] : 0,\r\n width: 80,\r\n },\r\n\r\n root: {\r\n marginBottom: t.spacing.componentGap,\r\n width: \"100%\",\r\n },\r\n });\r\n};\r\n",
+ "content": "import { StyleSheet } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { PdfFormVariant } from \"./form.types\";\n\n/** Style factory for fillable form layouts, derived from the active theme. */\nexport const createFormStyles = (\n t: PdfcnTheme,\n variant: PdfFormVariant = \"underline\"\n) => {\n const { spacing, borderRadius, fontWeights, typography } = t.primitives;\n const borderColor = t.colors.border;\n // lighter than spacing[0.5]=2pt — more refined\n const hairline = 0.75;\n // group title rule\n const rule = 1;\n\n const fieldAreaByVariant: Record<PdfFormVariant, object> = {\n box: {\n borderColor,\n borderRadius: borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: hairline,\n },\n ghost: {\n backgroundColor: t.colors.muted,\n borderRadius: borderRadius.sm,\n },\n outlined: {\n borderColor: t.colors.foreground,\n borderRadius: borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: hairline,\n },\n underline: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n },\n };\n\n const hasPadding =\n variant === \"box\" || variant === \"outlined\" || variant === \"ghost\";\n\n return StyleSheet.create({\n column: {\n flex: 1,\n },\n\n columnsRow: {\n flexDirection: \"row\",\n gap: spacing[4],\n },\n fieldAbove: {\n marginBottom: spacing[3],\n width: \"100%\",\n },\n fieldArea: {\n width: \"100%\" as const,\n ...fieldAreaByVariant[variant],\n },\n\n fieldLeft: {\n alignItems: \"flex-end\",\n flexDirection: \"row\",\n gap: spacing[2],\n marginBottom: spacing[3],\n },\n fieldLeftArea: {\n flex: 1,\n },\n\n formDivider: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n marginBottom: spacing[4],\n },\n formSubtitle: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n lineHeight: t.typography.body.lineHeight,\n marginBottom: spacing[3],\n },\n\n formTitle: {\n color: t.colors.foreground,\n fontFamily: t.typography.heading.fontFamily,\n fontSize: typography.xl,\n fontWeight: fontWeights.bold,\n lineHeight: t.typography.heading.lineHeight,\n marginBottom: spacing[1],\n },\n group: {\n marginBottom: spacing[5],\n },\n\n groupTitle: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.8,\n lineHeight: 1.2,\n marginBottom: spacing[3],\n textTransform: \"uppercase\",\n },\n hint: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n opacity: 0.14,\n paddingBottom: hasPadding ? spacing[1] : 0,\n paddingHorizontal: hasPadding ? spacing[2] : 0,\n paddingTop: hasPadding ? spacing[1] : spacing[0.5],\n },\n labelAbove: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.medium,\n letterSpacing: 0.5,\n lineHeight: 1.2,\n marginBottom: spacing[1],\n textTransform: \"uppercase\",\n },\n\n labelLeft: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.medium,\n lineHeight: t.typography.body.lineHeight,\n paddingBottom: hasPadding ? spacing[1] : 0,\n width: 80,\n },\n\n root: {\n marginBottom: t.spacing.componentGap,\n width: \"100%\",\n },\n });\n};\n",
"type": "registry:component",
"target": "components/pdf/form/form.styles.ts"
},
{
"path": "registry/bases/forme/components/form/form.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport {\r\n Text as PDFText,\r\n View,\r\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\n\r\nimport { createFormStyles } from \"./form.styles\";\r\nimport type {\r\n FormLayout,\r\n PdfFormField,\r\n PdfFormGroup,\r\n PdfFormProps,\r\n} from \"./form.types\";\r\n\r\nconst renderFieldAbove = (\r\n field: PdfFormField,\r\n idx: number,\r\n styles: ReturnType<typeof createFormStyles>\r\n) => {\r\n const areaHeight = field.height ?? 18;\r\n const areaStyle: Style[] = [styles.fieldArea, { minHeight: areaHeight }];\r\n\r\n return (\r\n <View key={`${field.label}-${idx}`} style={styles.fieldAbove}>\r\n <PDFText style={styles.labelAbove}>{field.label}</PDFText>\r\n <View style={areaStyle as never}>\r\n {field.hint ? (\r\n <PDFText style={styles.hint}>{field.hint}</PDFText>\r\n ) : null}\r\n </View>\r\n </View>\r\n );\r\n};\r\n\r\nconst renderFieldLeft = (\r\n field: PdfFormField,\r\n idx: number,\r\n styles: ReturnType<typeof createFormStyles>\r\n) => {\r\n const areaHeight = field.height ?? 18;\r\n const areaStyle: Style[] = [\r\n styles.fieldArea,\r\n styles.fieldLeftArea,\r\n { minHeight: areaHeight },\r\n ];\r\n\r\n return (\r\n <View key={`${field.label}-${idx}`} style={styles.fieldLeft}>\r\n <PDFText style={styles.labelLeft}>{field.label}</PDFText>\r\n <View style={areaStyle as never}>\r\n {field.hint ? (\r\n <PDFText style={styles.hint}>{field.hint}</PDFText>\r\n ) : null}\r\n </View>\r\n </View>\r\n );\r\n};\r\n\r\nconst renderGroup = (\r\n group: PdfFormGroup,\r\n gi: number,\r\n styles: ReturnType<typeof createFormStyles>,\r\n labelPosition: \"above\" | \"left\"\r\n) => {\r\n const layout: FormLayout = group.layout ?? \"single\";\r\n let cols: number;\r\n if (layout === \"three-column\") {\r\n cols = 3;\r\n } else if (layout === \"two-column\") {\r\n cols = 2;\r\n } else {\r\n cols = 1;\r\n }\r\n\r\n const renderField = (field: PdfFormField, idx: number) =>\r\n labelPosition === \"left\"\r\n ? renderFieldLeft(field, idx, styles)\r\n : renderFieldAbove(field, idx, styles);\r\n\r\n if (cols === 1) {\r\n return (\r\n <View key={`group-${gi}`} style={styles.group}>\r\n {group.title ? (\r\n <PDFText style={styles.groupTitle}>{group.title}</PDFText>\r\n ) : null}\r\n {group.fields.map(renderField)}\r\n </View>\r\n );\r\n }\r\n\r\n const chunkSize = Math.ceil(group.fields.length / cols);\r\n const chunks: PdfFormField[][] = [];\r\n for (let i = 0; i < group.fields.length; i += chunkSize) {\r\n chunks.push(group.fields.slice(i, i + chunkSize));\r\n }\r\n while (chunks.length < cols) {\r\n chunks.push([]);\r\n }\r\n\r\n return (\r\n <View key={`group-${gi}`} style={styles.group}>\r\n {group.title ? (\r\n <PDFText style={styles.groupTitle}>{group.title}</PDFText>\r\n ) : null}\r\n <View style={styles.columnsRow}>\r\n {chunks.map((chunk, ci) => (\r\n <View\r\n key={`col-${gi}-${chunk[0]?.label ?? ci}`}\r\n style={styles.column}\r\n >\r\n {chunk.map(renderField)}\r\n </View>\r\n ))}\r\n </View>\r\n </View>\r\n );\r\n};\r\n\r\nexport const PdfForm = ({\r\n title,\r\n subtitle,\r\n groups,\r\n variant = \"underline\",\r\n labelPosition = \"above\",\r\n noWrap = false,\r\n style,\r\n}: PdfFormProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(\r\n () => createFormStyles(theme, variant),\r\n [theme, variant]\r\n );\r\n\r\n const rootStyles: Style[] = [styles.root];\r\n if (style) {\r\n rootStyles.push(style);\r\n }\r\n\r\n const inner = (\r\n <View style={rootStyles as never}>\r\n {title ? <PDFText style={styles.formTitle}>{title}</PDFText> : null}\r\n {subtitle ? (\r\n <PDFText style={styles.formSubtitle}>{subtitle}</PDFText>\r\n ) : null}\r\n {title || subtitle ? <View style={styles.formDivider} /> : null}\r\n {groups.map((group, gi) => renderGroup(group, gi, styles, labelPosition))}\r\n </View>\r\n );\r\n\r\n return noWrap ? <View wrap={false}>{inner}</View> : inner;\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Text as PDFText,\n View,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\n\nimport { createFormStyles } from \"./form.styles\";\nimport type {\n FormLayout,\n PdfFormField,\n PdfFormGroup,\n PdfFormProps,\n} from \"./form.types\";\n\nconst renderFieldAbove = (\n field: PdfFormField,\n idx: number,\n styles: ReturnType<typeof createFormStyles>\n) => {\n const areaHeight = field.height ?? 18;\n const areaStyle: Style[] = [styles.fieldArea, { minHeight: areaHeight }];\n\n return (\n <View key={`${field.label}-${idx}`} style={styles.fieldAbove}>\n <PDFText style={styles.labelAbove}>{field.label}</PDFText>\n <View style={areaStyle as never}>\n {field.hint ? (\n <PDFText style={styles.hint}>{field.hint}</PDFText>\n ) : null}\n </View>\n </View>\n );\n};\n\nconst renderFieldLeft = (\n field: PdfFormField,\n idx: number,\n styles: ReturnType<typeof createFormStyles>\n) => {\n const areaHeight = field.height ?? 18;\n const areaStyle: Style[] = [\n styles.fieldArea,\n styles.fieldLeftArea,\n { minHeight: areaHeight },\n ];\n\n return (\n <View key={`${field.label}-${idx}`} style={styles.fieldLeft}>\n <PDFText style={styles.labelLeft}>{field.label}</PDFText>\n <View style={areaStyle as never}>\n {field.hint ? (\n <PDFText style={styles.hint}>{field.hint}</PDFText>\n ) : null}\n </View>\n </View>\n );\n};\n\nconst renderGroup = (\n group: PdfFormGroup,\n gi: number,\n styles: ReturnType<typeof createFormStyles>,\n labelPosition: \"above\" | \"left\"\n) => {\n const layout: FormLayout = group.layout ?? \"single\";\n let cols: number;\n if (layout === \"three-column\") {\n cols = 3;\n } else if (layout === \"two-column\") {\n cols = 2;\n } else {\n cols = 1;\n }\n\n const renderField = (field: PdfFormField, idx: number) =>\n labelPosition === \"left\"\n ? renderFieldLeft(field, idx, styles)\n : renderFieldAbove(field, idx, styles);\n\n if (cols === 1) {\n return (\n <View key={`group-${gi}`} style={styles.group}>\n {group.title ? (\n <PDFText style={styles.groupTitle}>{group.title}</PDFText>\n ) : null}\n {group.fields.map(renderField)}\n </View>\n );\n }\n\n const chunkSize = Math.ceil(group.fields.length / cols);\n const chunks: PdfFormField[][] = [];\n for (let i = 0; i < group.fields.length; i += chunkSize) {\n chunks.push(group.fields.slice(i, i + chunkSize));\n }\n while (chunks.length < cols) {\n chunks.push([]);\n }\n\n return (\n <View key={`group-${gi}`} style={styles.group}>\n {group.title ? (\n <PDFText style={styles.groupTitle}>{group.title}</PDFText>\n ) : null}\n <View style={styles.columnsRow}>\n {chunks.map((chunk, ci) => (\n <View\n key={`col-${gi}-${chunk[0]?.label ?? ci}`}\n style={styles.column}\n >\n {chunk.map(renderField)}\n </View>\n ))}\n </View>\n </View>\n );\n};\n\nexport const PdfForm = ({\n title,\n subtitle,\n groups,\n variant = \"underline\",\n labelPosition = \"above\",\n noWrap = false,\n style,\n}: PdfFormProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(\n () => createFormStyles(theme, variant),\n [theme, variant]\n );\n\n const rootStyles: Style[] = [styles.root];\n if (style) {\n rootStyles.push(style);\n }\n\n const inner = (\n <View style={rootStyles as never}>\n {title ? <PDFText style={styles.formTitle}>{title}</PDFText> : null}\n {subtitle ? (\n <PDFText style={styles.formSubtitle}>{subtitle}</PDFText>\n ) : null}\n {title || subtitle ? <View style={styles.formDivider} /> : null}\n {groups.map((group, gi) => renderGroup(group, gi, styles, labelPosition))}\n </View>\n );\n\n return noWrap ? <View wrap={false}>{inner}</View> : inner;\n};\n",
"type": "registry:component",
"target": "components/pdf/form/form.tsx"
},
{
"path": "registry/bases/forme/components/form/form.types.ts",
- "content": "import type { Style } from \"@formepdf/react\";\r\n\r\n/** Visual style variant for the fillable form. */\r\nexport type PdfFormVariant = \"underline\" | \"box\" | \"outlined\" | \"ghost\";\r\n\r\n/** Column layout for a form section. */\r\nexport type FormLayout = \"single\" | \"two-column\" | \"three-column\";\r\n\r\n/** Label position relative to the field. */\r\nexport type FormLabelPosition = \"above\" | \"left\";\r\n\r\n/**\r\n * A single fillable field definition.\r\n * Props - `label` | `hint` | `height` | `width`\r\n * @see {@link PdfFormField}\r\n */\r\nexport interface PdfFormField {\r\n label: string;\r\n hint?: string;\r\n /**\r\n * Height of the blank field area in points.\r\n * @default 18\r\n */\r\n height?: number;\r\n width?: number | string;\r\n}\r\n\r\n/**\r\n * A logical group of fields with an optional section title.\r\n * Props - `title` | `fields` | `layout`\r\n * @see {@link PdfFormGroup}\r\n */\r\nexport interface PdfFormGroup {\r\n title?: string;\r\n fields: PdfFormField[];\r\n /**\r\n * @default 'single'\r\n */\r\n layout?: FormLayout;\r\n}\r\n\r\n/**\r\n * Fillable PDF form with grouped fields, layout variants, and label positioning options.\r\n * Props - `title` | `subtitle` | `groups` | `variant` | `labelPosition` | `noWrap` | `style`\r\n * @see {@link PdfFormProps}\r\n */\r\nexport interface PdfFormProps {\r\n title?: string;\r\n subtitle?: string;\r\n groups: PdfFormGroup[];\r\n /**\r\n * @default 'underline'\r\n */\r\n variant?: PdfFormVariant;\r\n /**\r\n * @default 'above'\r\n */\r\n labelPosition?: FormLabelPosition;\r\n noWrap?: boolean;\r\n style?: Style;\r\n}\r\n",
+ "content": "import type { Style } from \"@formepdf/react\";\n\n/** Visual style variant for the fillable form. */\nexport type PdfFormVariant = \"underline\" | \"box\" | \"outlined\" | \"ghost\";\n\n/** Column layout for a form section. */\nexport type FormLayout = \"single\" | \"two-column\" | \"three-column\";\n\n/** Label position relative to the field. */\nexport type FormLabelPosition = \"above\" | \"left\";\n\n/**\n * A single fillable field definition.\n * Props - `label` | `hint` | `height` | `width`\n * @see {@link PdfFormField}\n */\nexport interface PdfFormField {\n label: string;\n hint?: string;\n /**\n * Height of the blank field area in points.\n * @default 18\n */\n height?: number;\n width?: number | string;\n}\n\n/**\n * A logical group of fields with an optional section title.\n * Props - `title` | `fields` | `layout`\n * @see {@link PdfFormGroup}\n */\nexport interface PdfFormGroup {\n title?: string;\n fields: PdfFormField[];\n /**\n * @default 'single'\n */\n layout?: FormLayout;\n}\n\n/**\n * Fillable PDF form with grouped fields, layout variants, and label positioning options.\n * Props - `title` | `subtitle` | `groups` | `variant` | `labelPosition` | `noWrap` | `style`\n * @see {@link PdfFormProps}\n */\nexport interface PdfFormProps {\n title?: string;\n subtitle?: string;\n groups: PdfFormGroup[];\n /**\n * @default 'underline'\n */\n variant?: PdfFormVariant;\n /**\n * @default 'above'\n */\n labelPosition?: FormLabelPosition;\n noWrap?: boolean;\n style?: Style;\n}\n",
"type": "registry:component",
"target": "components/pdf/form/form.types.ts"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/gift-certificate.json b/apps/web/public/r/forme/gift-certificate.json
index bfbd9b0..4a6f74f 100644
--- a/apps/web/public/r/forme/gift-certificate.json
+++ b/apps/web/public/r/forme/gift-certificate.json
@@ -16,7 +16,7 @@
"files": [
{
"path": "registry/bases/forme/blocks/gift-certificate/gift-certificate.tsx",
- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { PdfImage } from \"@/registry/bases/forme/components/pdf-image/pdf-image\";\nimport { Section } from \"@/registry/bases/forme/components/section/section\";\nimport { Text } from \"@/registry/bases/forme/components/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type { GiftCertificateData } from \"./gift-certificate.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: GiftCertificateData = {\n accentColor: \"#000000\",\n amount: 50,\n certificateCode: \"PDFCN-GC-2026-00891\",\n companyLogo: \"/favicon.png\",\n companyName: \"pdfcn\",\n currency: \"USD\",\n expiryDate: \"March 31, 2027\",\n message: \"Happy Birthday! Enjoy a coffee on us.\",\n recipientName: \"Sarah\",\n redemptionInstructions: \"Present this certificate at any pdfcn location.\",\n senderName: \"Mom & Dad\",\n terms: \"No cash value. Non-refundable. One use per visit.\",\n};\n\nconst GiftCertificateContent = ({ data }: { data: GiftCertificateData }) => {\n const theme = usePdfcnTheme();\n const accentColor = data.accentColor || \"#000000\";\n const currencySymbol = data.currency === \"USD\" ? \"$\" : data.currency || \"$\";\n\n const styles = StyleSheet.create({\n amount: {\n color: accentColor,\n fontSize: 36,\n fontWeight: \"bold\",\n },\n amountContainer: {\n alignItems: \"center\",\n backgroundColor: theme.colors.muted,\n borderColor: accentColor,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 2,\n marginBottom: 10,\n marginTop: 10,\n paddingHorizontal: 20,\n paddingVertical: 12,\n },\n code: {\n color: theme.colors.foreground,\n fontFamily: \"Courier\",\n fontSize: 13,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n },\n codeBox: {\n alignItems: \"center\",\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: 1,\n marginBottom: 8,\n marginTop: 8,\n paddingHorizontal: 14,\n paddingVertical: 8,\n },\n decorativeBorder: {\n borderColor: accentColor,\n borderRadius: theme.primitives.borderRadius.lg,\n borderStyle: \"solid\",\n borderWidth: 3,\n padding: 16,\n position: \"relative\",\n },\n fieldLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n fontWeight: \"bold\",\n letterSpacing: 1,\n marginBottom: 4,\n textTransform: \"uppercase\",\n },\n fieldValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: 500,\n },\n header: {\n alignItems: \"center\",\n marginBottom: 8,\n },\n innerBorder: {\n borderColor: accentColor,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"dashed\",\n borderWidth: 1,\n padding: 18,\n },\n instructionsBox: {\n marginTop: 8,\n },\n logo: {\n height: 28,\n marginBottom: 6,\n width: 28,\n },\n messageBox: {\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.sm,\n marginBottom: 8,\n marginTop: 8,\n padding: 10,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n termsText: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n lineHeight: 1.4,\n textAlign: \"center\",\n },\n title: {\n color: accentColor,\n fontSize: 22,\n fontWeight: \"bold\",\n letterSpacing: 2,\n textAlign: \"center\",\n textTransform: \"uppercase\",\n },\n });\n\n return (\n <Document title={`Gift Certificate ${data.certificateCode}`}>\n <Page margin={24} size=\"A4\">\n <View style={styles.page as never}>\n <View style={styles.decorativeBorder as never}>\n <View style={styles.innerBorder as never}>\n <Section noWrap style={styles.header}>\n {data.companyLogo && (\n <PdfImage\n src={data.companyLogo ?? \"/favicon.png\"}\n style={styles.logo}\n />\n )}\n <Text style={styles.title} noMargin>\n Gift Certificate\n </Text>\n {data.companyName && (\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 13,\n fontWeight: 500,\n marginTop: 4,\n textAlign: \"center\",\n }}\n noMargin\n >\n {data.companyName}\n </Text>\n )}\n </Section>\n\n <Section noWrap style={styles.amountContainer}>\n <Text style={styles.amount} noMargin>\n {currencySymbol}\n {data.amount.toFixed(2)}\n </Text>\n </Section>\n\n <Section\n noWrap\n style={{\n flexDirection: \"row\",\n gap: 28,\n marginBottom: 8,\n }}\n >\n <View style={{ flex: 1 }}>\n <Text style={styles.fieldLabel} noMargin>\n To\n </Text>\n <Text style={styles.fieldValue} noMargin>\n {data.recipientName}\n </Text>\n </View>\n <View style={{ flex: 1 }}>\n <Text style={styles.fieldLabel} noMargin>\n From\n </Text>\n <Text style={styles.fieldValue} noMargin>\n {data.senderName}\n </Text>\n </View>\n </Section>\n\n {data.message && (\n <Section noWrap style={styles.messageBox}>\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 10,\n fontStyle: \"italic\",\n lineHeight: 1.4,\n textAlign: \"center\",\n }}\n noMargin\n >\n \"{data.message}\"\n </Text>\n </Section>\n )}\n\n <Section noWrap style={styles.codeBox}>\n <Text style={styles.fieldLabel} noMargin>\n Certificate Code\n </Text>\n <Text style={styles.code} noMargin>\n {data.certificateCode}\n </Text>\n </Section>\n\n <Section\n noWrap\n style={{\n alignItems: \"center\",\n marginBottom: 8,\n }}\n >\n <Text style={styles.fieldLabel} noMargin>\n Valid Until\n </Text>\n <Text\n style={{\n color: accentColor,\n fontSize: 12,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n {data.expiryDate}\n </Text>\n </Section>\n\n {data.redemptionInstructions && (\n <Section noWrap style={styles.instructionsBox}>\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 9,\n lineHeight: 1.3,\n textAlign: \"center\",\n }}\n noMargin\n >\n {data.redemptionInstructions}\n </Text>\n </Section>\n )}\n\n {data.terms && (\n <Section\n noWrap\n style={{\n marginTop: 10,\n }}\n >\n <Text style={styles.termsText} noMargin>\n {data.terms}\n </Text>\n </Section>\n )}\n </View>\n </View>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const GiftCertificateDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: GiftCertificateData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <GiftCertificateContent data={data} />\n </PdfcnThemeProvider>\n);\n",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { PdfImage } from \"@/components/pdf/pdf-image/pdf-image\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { GiftCertificateData } from \"./gift-certificate.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: GiftCertificateData = {\n accentColor: \"#000000\",\n amount: 50,\n certificateCode: \"PDFCN-GC-2026-00891\",\n companyLogo: \"/favicon.png\",\n companyName: \"pdfcn\",\n currency: \"USD\",\n expiryDate: \"March 31, 2027\",\n message: \"Happy Birthday! Enjoy a coffee on us.\",\n recipientName: \"Sarah\",\n redemptionInstructions: \"Present this certificate at any pdfcn location.\",\n senderName: \"Mom & Dad\",\n terms: \"No cash value. Non-refundable. One use per visit.\",\n};\n\nconst GiftCertificateContent = ({ data }: { data: GiftCertificateData }) => {\n const theme = usePdfcnTheme();\n const accentColor = data.accentColor || \"#000000\";\n const currencySymbol = data.currency === \"USD\" ? \"$\" : data.currency || \"$\";\n\n const styles = StyleSheet.create({\n amount: {\n color: accentColor,\n fontSize: 36,\n fontWeight: \"bold\",\n },\n amountContainer: {\n alignItems: \"center\",\n backgroundColor: theme.colors.muted,\n borderColor: accentColor,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 2,\n marginBottom: 10,\n marginTop: 10,\n paddingHorizontal: 20,\n paddingVertical: 12,\n },\n code: {\n color: theme.colors.foreground,\n fontFamily: \"Courier\",\n fontSize: 13,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n },\n codeBox: {\n alignItems: \"center\",\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: 1,\n marginBottom: 8,\n marginTop: 8,\n paddingHorizontal: 14,\n paddingVertical: 8,\n },\n decorativeBorder: {\n borderColor: accentColor,\n borderRadius: theme.primitives.borderRadius.lg,\n borderStyle: \"solid\",\n borderWidth: 3,\n padding: 16,\n position: \"relative\",\n },\n fieldLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n fontWeight: \"bold\",\n letterSpacing: 1,\n marginBottom: 4,\n textTransform: \"uppercase\",\n },\n fieldValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: 500,\n },\n header: {\n alignItems: \"center\",\n marginBottom: 8,\n },\n innerBorder: {\n borderColor: accentColor,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"dashed\",\n borderWidth: 1,\n padding: 18,\n },\n instructionsBox: {\n marginTop: 8,\n },\n logo: {\n height: 28,\n marginBottom: 6,\n width: 28,\n },\n messageBox: {\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.sm,\n marginBottom: 8,\n marginTop: 8,\n padding: 10,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n termsText: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n lineHeight: 1.4,\n textAlign: \"center\",\n },\n title: {\n color: accentColor,\n fontSize: 22,\n fontWeight: \"bold\",\n letterSpacing: 2,\n textAlign: \"center\",\n textTransform: \"uppercase\",\n },\n });\n\n return (\n <Document title={`Gift Certificate ${data.certificateCode}`}>\n <Page margin={24} size=\"A4\">\n <View style={styles.page as never}>\n <View style={styles.decorativeBorder as never}>\n <View style={styles.innerBorder as never}>\n <Section noWrap style={styles.header}>\n {data.companyLogo && (\n <PdfImage\n src={data.companyLogo ?? \"/favicon.png\"}\n style={styles.logo}\n />\n )}\n <Text style={styles.title} noMargin>\n Gift Certificate\n </Text>\n {data.companyName && (\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 13,\n fontWeight: 500,\n marginTop: 4,\n textAlign: \"center\",\n }}\n noMargin\n >\n {data.companyName}\n </Text>\n )}\n </Section>\n\n <Section noWrap style={styles.amountContainer}>\n <Text style={styles.amount} noMargin>\n {currencySymbol}\n {data.amount.toFixed(2)}\n </Text>\n </Section>\n\n <Section\n noWrap\n style={{\n flexDirection: \"row\",\n gap: 28,\n marginBottom: 8,\n }}\n >\n <View style={{ flex: 1 }}>\n <Text style={styles.fieldLabel} noMargin>\n To\n </Text>\n <Text style={styles.fieldValue} noMargin>\n {data.recipientName}\n </Text>\n </View>\n <View style={{ flex: 1 }}>\n <Text style={styles.fieldLabel} noMargin>\n From\n </Text>\n <Text style={styles.fieldValue} noMargin>\n {data.senderName}\n </Text>\n </View>\n </Section>\n\n {data.message && (\n <Section noWrap style={styles.messageBox}>\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 10,\n fontStyle: \"italic\",\n lineHeight: 1.4,\n textAlign: \"center\",\n }}\n noMargin\n >\n \"{data.message}\"\n </Text>\n </Section>\n )}\n\n <Section noWrap style={styles.codeBox}>\n <Text style={styles.fieldLabel} noMargin>\n Certificate Code\n </Text>\n <Text style={styles.code} noMargin>\n {data.certificateCode}\n </Text>\n </Section>\n\n <Section\n noWrap\n style={{\n alignItems: \"center\",\n marginBottom: 8,\n }}\n >\n <Text style={styles.fieldLabel} noMargin>\n Valid Until\n </Text>\n <Text\n style={{\n color: accentColor,\n fontSize: 12,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n {data.expiryDate}\n </Text>\n </Section>\n\n {data.redemptionInstructions && (\n <Section noWrap style={styles.instructionsBox}>\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 9,\n lineHeight: 1.3,\n textAlign: \"center\",\n }}\n noMargin\n >\n {data.redemptionInstructions}\n </Text>\n </Section>\n )}\n\n {data.terms && (\n <Section\n noWrap\n style={{\n marginTop: 10,\n }}\n >\n <Text style={styles.termsText} noMargin>\n {data.terms}\n </Text>\n </Section>\n )}\n </View>\n </View>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const GiftCertificateDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: GiftCertificateData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <GiftCertificateContent data={data} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/gift-certificate/gift-certificate.tsx"
},
@@ -28,4 +28,4 @@
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/graph.json b/apps/web/public/r/forme/graph.json
index 65172c8..6a0babb 100644
--- a/apps/web/public/r/forme/graph.json
+++ b/apps/web/public/r/forme/graph.json
@@ -13,28 +13,28 @@
"files": [
{
"path": "registry/bases/forme/components/graph/graph.styles.ts",
- "content": "import { StyleSheet } from \"@formepdf/react\";\r\n\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport const createGraphStyles = (t: PdfcnTheme) =>\r\n StyleSheet.create({\r\n chartWithRightLegend: {\r\n alignItems: \"flex-start\",\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n },\r\n container: {\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n marginBottom: t.spacing.componentGap,\r\n },\r\n legendColumn: {\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n gap: 8,\r\n marginLeft: 12,\r\n marginTop: 18,\r\n minWidth: 120,\r\n },\r\n legendItem: {\r\n alignItems: \"center\",\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n gap: 4,\r\n },\r\n legendRow: {\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n flexWrap: \"wrap\",\r\n gap: 12,\r\n marginTop: 6,\r\n },\r\n legendText: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n },\r\n subtitle: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n marginBottom: 6,\r\n },\r\n title: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.heading.fontFamily,\r\n fontSize: t.primitives.typography.base,\r\n fontWeight: t.primitives.fontWeights.semibold,\r\n marginBottom: 2,\r\n },\r\n });\r\n",
+ "content": "import { StyleSheet } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport const createGraphStyles = (t: PdfcnTheme) =>\n StyleSheet.create({\n chartWithRightLegend: {\n alignItems: \"flex-start\",\n display: \"flex\",\n flexDirection: \"row\",\n },\n container: {\n display: \"flex\",\n flexDirection: \"column\",\n marginBottom: t.spacing.componentGap,\n },\n legendColumn: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: 8,\n marginLeft: 12,\n marginTop: 18,\n minWidth: 120,\n },\n legendItem: {\n alignItems: \"center\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: 4,\n },\n legendRow: {\n display: \"flex\",\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 12,\n marginTop: 6,\n },\n legendText: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n },\n subtitle: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginBottom: 6,\n },\n title: {\n color: t.colors.foreground,\n fontFamily: t.typography.heading.fontFamily,\n fontSize: t.primitives.typography.base,\n fontWeight: t.primitives.fontWeights.semibold,\n marginBottom: 2,\n },\n });\n",
"type": "registry:component",
"target": "components/pdf/graph/graph.styles.ts"
},
{
"path": "registry/bases/forme/components/graph/graph.tsx",
- "content": "import type React from \"react\";\r\n\r\nimport {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport {\r\n Text as PDFText,\r\n View,\r\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport {\r\n Circle,\r\n G,\r\n Line,\r\n Path,\r\n Rect,\r\n Svg,\r\n SvgText,\r\n} from \"@/registry/bases/forme/lib/pdf-svg\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport { createGraphStyles } from \"./graph.styles\";\r\nimport type { ChartLayout, GraphProps, GraphSeries } from \"./graph.types\";\r\nimport {\r\n GRAPH_SAFE_WIDTHS,\r\n arcPath,\r\n buildLayout,\r\n fmtNum,\r\n getDefaultPalette,\r\n getGraphWidth,\r\n normalizeData,\r\n polarToCartesian,\r\n smoothPath,\r\n truncate,\r\n} from \"./graph.utils\";\r\n\r\n/**\r\n * Shared Y-axis grid lines and tick labels for cartesian charts (bar, line, area).\r\n * Extracted to avoid duplicating the identical block across render functions.\r\n */\r\nconst renderGridAndYAxis = (\r\n ticks: number[],\r\n toY: (v: number) => number,\r\n chartX: number,\r\n chartW: number,\r\n showGrid: boolean,\r\n gridColor: string,\r\n textColor: string\r\n) => (\r\n <>\r\n {ticks.map((tick) => {\r\n const ty = toY(tick);\r\n return (\r\n <G key={`grid-${tick}`}>\r\n {showGrid && (\r\n <Line\r\n x1={chartX}\r\n y1={ty}\r\n x2={chartX + chartW}\r\n y2={ty}\r\n stroke={gridColor}\r\n strokeWidth={0.5}\r\n strokeDasharray=\"3 3\"\r\n />\r\n )}\r\n <SvgText\r\n x={chartX - 4}\r\n y={ty + 3}\r\n fill={textColor}\r\n textAnchor=\"end\"\r\n style={{ fontSize: 7 }}\r\n >\r\n {fmtNum(tick)}\r\n </SvgText>\r\n </G>\r\n );\r\n })}\r\n </>\r\n);\r\n\r\nconst renderBarChart = (\r\n series: GraphSeries[],\r\n layout: ChartLayout,\r\n palette: string[],\r\n showGrid: boolean,\r\n showValues: boolean,\r\n theme: PdfcnTheme\r\n) => {\r\n const { chartX, chartY, chartW, chartH, yMin, yMax, yTicks, xLabels } =\r\n layout;\r\n const nCategories = xLabels.length;\r\n const nSeries = series.length;\r\n const groupGap = 0.25;\r\n const groupW = chartW / nCategories;\r\n const barW = (groupW * (1 - groupGap)) / nSeries;\r\n const textColor = theme.colors.mutedForeground;\r\n const gridColor = theme.colors.border;\r\n const axisColor = theme.colors.foreground;\r\n const range = yMax - yMin || 1;\r\n const toY = (v: number) => chartY + chartH - ((v - yMin) / range) * chartH;\r\n\r\n return (\r\n <>\r\n {renderGridAndYAxis(\r\n yTicks,\r\n toY,\r\n chartX,\r\n chartW,\r\n showGrid,\r\n gridColor,\r\n textColor\r\n )}\r\n\r\n <Line\r\n x1={chartX}\r\n y1={chartY + chartH}\r\n x2={chartX + chartW}\r\n y2={chartY + chartH}\r\n stroke={axisColor}\r\n strokeWidth={1}\r\n />\r\n\r\n {xLabels.map((label, ci) => {\r\n const groupLeft = chartX + ci * groupW + groupW * (groupGap / 2);\r\n return (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\r\n <G key={`group-${ci}`}>\r\n {series.map((s, si) => {\r\n const val = s.data[ci]?.value ?? 0;\r\n const color =\r\n s.data[ci]?.color ?? s.color ?? palette[si % palette.length];\r\n const barH = ((val - yMin) / range) * chartH;\r\n const bx = groupLeft + si * barW;\r\n const by = chartY + chartH - barH;\r\n return (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\r\n <G key={`bar-${ci}-${si}`}>\r\n <Rect\r\n x={bx}\r\n y={by}\r\n width={barW - 1}\r\n height={barH}\r\n fill={color}\r\n />\r\n {showValues && barH > 10 && (\r\n <SvgText\r\n x={bx + barW / 2 - 0.5}\r\n y={by - 2}\r\n fill={axisColor}\r\n textAnchor=\"middle\"\r\n style={{ fontSize: 6 }}\r\n >\r\n {fmtNum(val)}\r\n </SvgText>\r\n )}\r\n </G>\r\n );\r\n })}\r\n <SvgText\r\n x={groupLeft + (nSeries * barW) / 2}\r\n y={chartY + chartH + 10}\r\n fill={textColor}\r\n textAnchor=\"middle\"\r\n style={{ fontSize: 7 }}\r\n >\r\n {truncate(label, 10)}\r\n </SvgText>\r\n </G>\r\n );\r\n })}\r\n </>\r\n );\r\n};\r\n\r\nconst renderHorizontalBarChart = (\r\n series: GraphSeries[],\r\n layout: ChartLayout,\r\n palette: string[],\r\n showValues: boolean,\r\n theme: PdfcnTheme\r\n) => {\r\n const { chartX, chartY, chartW, chartH, xLabels } = layout;\r\n const nCategories = xLabels.length;\r\n const allValues = series.flatMap((s) => s.data.map((d) => d.value));\r\n const maxVal = Math.max(...allValues, 1);\r\n const rowH = chartH / nCategories;\r\n const barH = rowH * 0.5;\r\n const textColor = theme.colors.mutedForeground;\r\n const axisColor = theme.colors.foreground;\r\n const labelW = 60;\r\n\r\n return (\r\n <>\r\n {xLabels.map((label, ci) => {\r\n const rowY = chartY + ci * rowH;\r\n const val = series[0]?.data[ci]?.value ?? 0;\r\n const color =\r\n series[0]?.data[ci]?.color ??\r\n series[0]?.color ??\r\n palette[ci % palette.length];\r\n const barW = (val / maxVal) * (chartW - labelW);\r\n return (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\r\n <G key={`hbar-${ci}`}>\r\n <SvgText\r\n x={chartX + labelW - 4}\r\n y={rowY + rowH / 2 + 3}\r\n fill={textColor}\r\n textAnchor=\"end\"\r\n style={{ fontSize: 7 }}\r\n >\r\n {truncate(label, 14)}\r\n </SvgText>\r\n <Rect\r\n x={chartX + labelW}\r\n y={rowY + (rowH - barH) / 2}\r\n width={Math.max(barW, 1)}\r\n height={barH}\r\n fill={color}\r\n />\r\n {showValues && (\r\n <SvgText\r\n x={chartX + labelW + barW + 3}\r\n y={rowY + rowH / 2 + 3}\r\n fill={axisColor}\r\n textAnchor=\"start\"\r\n style={{ fontSize: 6 }}\r\n >\r\n {fmtNum(val)}\r\n </SvgText>\r\n )}\r\n </G>\r\n );\r\n })}\r\n <Line\r\n x1={chartX + labelW}\r\n y1={chartY}\r\n x2={chartX + labelW}\r\n y2={chartY + chartH}\r\n stroke={axisColor}\r\n strokeWidth={1}\r\n />\r\n </>\r\n );\r\n};\r\n\r\nconst renderLineAreaChart = (\r\n series: GraphSeries[],\r\n layout: ChartLayout,\r\n palette: string[],\r\n showGrid: boolean,\r\n showValues: boolean,\r\n showDots: boolean,\r\n smooth: boolean,\r\n isArea: boolean,\r\n theme: PdfcnTheme\r\n) => {\r\n const { chartX, chartY, chartW, chartH, yMin, yMax, yTicks, xLabels } =\r\n layout;\r\n const range = yMax - yMin || 1;\r\n const textColor = theme.colors.mutedForeground;\r\n const gridColor = theme.colors.border;\r\n const axisColor = theme.colors.foreground;\r\n const nPoints = xLabels.length;\r\n\r\n const xFor = (i: number) => chartX + (i / Math.max(nPoints - 1, 1)) * chartW;\r\n const yFor = (v: number) => chartY + chartH - ((v - yMin) / range) * chartH;\r\n\r\n return (\r\n <>\r\n {renderGridAndYAxis(\r\n yTicks,\r\n yFor,\r\n chartX,\r\n chartW,\r\n showGrid,\r\n gridColor,\r\n textColor\r\n )}\r\n\r\n <Line\r\n x1={chartX}\r\n y1={chartY + chartH}\r\n x2={chartX + chartW}\r\n y2={chartY + chartH}\r\n stroke={axisColor}\r\n strokeWidth={1}\r\n />\r\n\r\n {series.map((s, si) => {\r\n const color = s.color ?? palette[si % palette.length];\r\n const points = s.data.map((d, i) => ({ x: xFor(i), y: yFor(d.value) }));\r\n\r\n const lineDStr = smooth\r\n ? smoothPath(points)\r\n : `M ${points.map((p) => `${p.x} ${p.y}`).join(\" L \")}`;\r\n\r\n const lastPoint = points.at(-1);\r\n const firstPoint = points.at(0);\r\n const areaPath =\r\n isArea && points.length > 1 && lastPoint && firstPoint\r\n ? `${lineDStr} L ${lastPoint.x} ${chartY + chartH} L ${firstPoint.x} ${chartY + chartH} Z`\r\n : null;\r\n\r\n return (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\r\n <G key={`series-${si}`}>\r\n {isArea && areaPath && (\r\n <Path d={areaPath} fill={color} fillOpacity={0.2} stroke=\"none\" />\r\n )}\r\n <Path d={lineDStr} stroke={color} strokeWidth={2} fill=\"none\" />\r\n {showDots &&\r\n points.map((p, pi) => (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\r\n <Circle\r\n key={`dot-${pi}`}\r\n cx={p.x}\r\n cy={p.y}\r\n r={3}\r\n fill={color}\r\n />\r\n ))}\r\n {showValues &&\r\n points.map((p, pi) => (\r\n <SvgText\r\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\r\n key={`val-${pi}`}\r\n x={p.x}\r\n y={p.y - 5}\r\n fill={color}\r\n textAnchor=\"middle\"\r\n style={{ fontSize: 6 }}\r\n >\r\n {fmtNum(s.data[pi].value)}\r\n </SvgText>\r\n ))}\r\n </G>\r\n );\r\n })}\r\n\r\n {xLabels.map((label, i) => (\r\n <SvgText\r\n key={`xlabel-${label}`}\r\n x={xFor(i)}\r\n y={chartY + chartH + 10}\r\n fill={textColor}\r\n textAnchor=\"middle\"\r\n style={{ fontSize: 7 }}\r\n >\r\n {truncate(label, 8)}\r\n </SvgText>\r\n ))}\r\n </>\r\n );\r\n};\r\n\r\nconst renderPieDonutChart = (\r\n series: GraphSeries[],\r\n layout: ChartLayout,\r\n palette: string[],\r\n centerLabel: string | undefined,\r\n isDonut: boolean,\r\n theme: PdfcnTheme\r\n) => {\r\n const { svgW, svgH } = layout;\r\n const cx = svgW / 2;\r\n const cy = svgH / 2;\r\n const r = Math.min(svgW, svgH) / 2 - 20;\r\n const innerR = isDonut ? r * 0.52 : 0;\r\n const textColor = theme.colors.mutedForeground;\r\n\r\n const data = series[0]?.data ?? [];\r\n const total = data.reduce((sum, d) => sum + d.value, 0) || 1;\r\n\r\n let currentAngle = 0;\r\n\r\n return (\r\n <>\r\n {data.map((d, i) => {\r\n const color = d.color ?? palette[i % palette.length];\r\n const sweep = (d.value / total) * 360;\r\n const midAngle = currentAngle + sweep / 2;\r\n const path = arcPath(\r\n cx,\r\n cy,\r\n r,\r\n currentAngle,\r\n currentAngle + sweep,\r\n innerR\r\n );\r\n currentAngle += sweep;\r\n\r\n const labelR = r * 1.18;\r\n const lp = polarToCartesian(cx, cy, labelR, midAngle);\r\n const anchor = lp.x > cx ? \"start\" : \"end\";\r\n\r\n return (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\r\n <G key={`slice-${i}`}>\r\n <Path d={path} fill={color} stroke=\"white\" strokeWidth={1} />\r\n {/* Show label only if slice is large enough to label */}\r\n {sweep > 15 && (\r\n <SvgText\r\n x={lp.x}\r\n y={lp.y + 3}\r\n fill={textColor}\r\n textAnchor={anchor}\r\n style={{ fontSize: 7 }}\r\n >\r\n {truncate(d.label, 10)}\r\n </SvgText>\r\n )}\r\n </G>\r\n );\r\n })}\r\n\r\n {isDonut && centerLabel && (\r\n <>\r\n <Circle cx={cx} cy={cy} r={innerR} fill=\"white\" />\r\n <SvgText\r\n x={cx}\r\n y={cy + 4}\r\n fill={theme.colors.foreground}\r\n textAnchor=\"middle\"\r\n style={{ fontSize: 9, fontWeight: \"bold\" }}\r\n >\r\n {centerLabel}\r\n </SvgText>\r\n </>\r\n )}\r\n </>\r\n );\r\n};\r\n\r\nconst Legend = ({\r\n series,\r\n palette,\r\n styles,\r\n position = \"bottom\",\r\n}: {\r\n series: GraphSeries[];\r\n palette: string[];\r\n styles: ReturnType<typeof createGraphStyles>;\r\n position?: \"bottom\" | \"right\";\r\n}) => {\r\n const containerStyle =\r\n position === \"right\" ? styles.legendColumn : styles.legendRow;\r\n\r\n return (\r\n <View style={containerStyle as never}>\r\n {series.map((s, i) => (\r\n <View key={s.name} style={styles.legendItem}>\r\n <Svg width={10} height={10}>\r\n <Rect\r\n x={0}\r\n y={2}\r\n width={8}\r\n height={8}\r\n fill={s.color ?? palette[i % palette.length]}\r\n />\r\n </Svg>\r\n <PDFText style={styles.legendText}>{s.name}</PDFText>\r\n </View>\r\n ))}\r\n </View>\r\n );\r\n};\r\n\r\nconst renderChartContent = (\r\n variant: string,\r\n series: GraphSeries[],\r\n layout: ChartLayout,\r\n palette: string[],\r\n showGrid: boolean,\r\n showValues: boolean,\r\n showDots: boolean,\r\n smooth: boolean,\r\n centerLabel: string | undefined,\r\n theme: PdfcnTheme\r\n): React.ReactNode => {\r\n switch (variant) {\r\n case \"bar\": {\r\n return renderBarChart(\r\n series,\r\n layout,\r\n palette,\r\n showGrid,\r\n showValues,\r\n theme\r\n );\r\n }\r\n case \"horizontal-bar\": {\r\n return renderHorizontalBarChart(\r\n series,\r\n layout,\r\n palette,\r\n showValues,\r\n theme\r\n );\r\n }\r\n case \"line\":\r\n case \"area\": {\r\n return renderLineAreaChart(\r\n series,\r\n layout,\r\n palette,\r\n showGrid,\r\n showValues,\r\n showDots,\r\n smooth,\r\n variant === \"area\",\r\n theme\r\n );\r\n }\r\n case \"pie\": {\r\n return renderPieDonutChart(\r\n series,\r\n layout,\r\n palette,\r\n undefined,\r\n false,\r\n theme\r\n );\r\n }\r\n case \"donut\": {\r\n return renderPieDonutChart(\r\n series,\r\n layout,\r\n palette,\r\n centerLabel,\r\n true,\r\n theme\r\n );\r\n }\r\n default: {\r\n return null;\r\n }\r\n }\r\n};\r\n\r\nconst renderAxisLabels = (\r\n isPieOrDonut: boolean,\r\n xLabel: string | undefined,\r\n yLabel: string | undefined,\r\n chartX: number,\r\n chartW: number,\r\n height: number,\r\n mutedForeground: string\r\n) => (\r\n <>\r\n {!isPieOrDonut && xLabel && (\r\n <SvgText\r\n x={chartX + chartW / 2}\r\n y={height - 2}\r\n fill={mutedForeground}\r\n textAnchor=\"middle\"\r\n style={{ fontSize: 8 }}\r\n >\r\n {xLabel}\r\n </SvgText>\r\n )}\r\n {!isPieOrDonut && yLabel && (\r\n <SvgText\r\n x={2}\r\n y={10}\r\n fill={mutedForeground}\r\n textAnchor=\"start\"\r\n style={{ fontSize: 8 }}\r\n >\r\n {yLabel}\r\n </SvgText>\r\n )}\r\n </>\r\n);\r\n\r\nconst renderTextFallback = (\r\n variant: GraphProps[\"variant\"],\r\n series: GraphSeries[],\r\n layout: ChartLayout,\r\n showValues: boolean,\r\n textColor: string\r\n) => {\r\n if (variant === \"pie\" || variant === \"donut\") {\r\n const data = series[0]?.data ?? [];\r\n const total = data.reduce((sum, point) => sum + point.value, 0) || 1;\r\n const cx = layout.svgW / 2;\r\n const cy = layout.svgH / 2;\r\n const radius = Math.min(layout.svgW, layout.svgH) / 2 - 20;\r\n const labelRadius = radius * 1.18;\r\n let currentAngle = 0;\r\n\r\n return (\r\n <View\r\n style={{\r\n height: layout.svgH,\r\n left: 0,\r\n position: \"absolute\",\r\n top: 0,\r\n width: layout.svgW,\r\n }}\r\n >\r\n {data.map((point, index) => {\r\n const sweep = (point.value / total) * 360;\r\n const midAngle = currentAngle + sweep / 2;\r\n currentAngle += sweep;\r\n if (sweep <= 15) {\r\n return null;\r\n }\r\n const labelPoint = polarToCartesian(cx, cy, labelRadius, midAngle);\r\n const onRight = labelPoint.x > cx;\r\n return (\r\n <PDFText\r\n key={`fallback-pie-${point.label}-${index}`}\r\n style={{\r\n color: textColor,\r\n fontSize: 7,\r\n left: onRight ? labelPoint.x : labelPoint.x - 60,\r\n lineHeight: 1,\r\n position: \"absolute\",\r\n textAlign: onRight ? \"left\" : \"right\",\r\n top: labelPoint.y - 4,\r\n width: 60,\r\n }}\r\n >\r\n {truncate(point.label, 10)}\r\n </PDFText>\r\n );\r\n })}\r\n </View>\r\n );\r\n }\r\n\r\n const {\r\n chartH,\r\n chartW,\r\n chartX,\r\n chartY,\r\n svgH,\r\n svgW,\r\n xLabels,\r\n yMax,\r\n yMin,\r\n yTicks,\r\n } = layout;\r\n const range = yMax - yMin || 1;\r\n const toY = (value: number) =>\r\n chartY + chartH - ((value - yMin) / range) * chartH;\r\n const labelStyle = {\r\n color: textColor,\r\n fontSize: 7,\r\n lineHeight: 1,\r\n position: \"absolute\" as const,\r\n };\r\n\r\n if (variant === \"horizontal-bar\") {\r\n const labelWidth = 60;\r\n const rowHeight = chartH / Math.max(xLabels.length, 1);\r\n const maxValue = Math.max(\r\n ...series.flatMap((item) => item.data.map((point) => point.value)),\r\n 1\r\n );\r\n\r\n return (\r\n <View\r\n style={{\r\n height: svgH,\r\n left: 0,\r\n position: \"absolute\",\r\n top: 0,\r\n width: svgW,\r\n }}\r\n >\r\n {xLabels.map((label, index) => {\r\n const value = series[0]?.data[index]?.value ?? 0;\r\n const barWidth = (value / maxValue) * (chartW - labelWidth);\r\n return (\r\n <View key={`fallback-horizontal-${label}`}>\r\n <PDFText\r\n style={{\r\n ...labelStyle,\r\n left: chartX,\r\n textAlign: \"right\",\r\n top: chartY + index * rowHeight + rowHeight / 2 - 4,\r\n width: labelWidth - 4,\r\n }}\r\n >\r\n {truncate(label, 14)}\r\n </PDFText>\r\n {showValues ? (\r\n <PDFText\r\n style={{\r\n ...labelStyle,\r\n color: textColor,\r\n fontSize: 6,\r\n left: chartX + labelWidth + barWidth + 3,\r\n top: chartY + index * rowHeight + rowHeight / 2 - 4,\r\n width: 28,\r\n }}\r\n >\r\n {fmtNum(value)}\r\n </PDFText>\r\n ) : null}\r\n </View>\r\n );\r\n })}\r\n </View>\r\n );\r\n }\r\n\r\n const pointX = (index: number) =>\r\n chartX + (index / Math.max(xLabels.length - 1, 1)) * chartW;\r\n const groupWidth = chartW / Math.max(xLabels.length, 1);\r\n const barGap = 2;\r\n const barWidth = Math.max(\r\n (groupWidth - barGap * (series.length + 1)) / Math.max(series.length, 1),\r\n 1\r\n );\r\n\r\n return (\r\n <View\r\n style={{\r\n height: svgH,\r\n left: 0,\r\n position: \"absolute\",\r\n top: 0,\r\n width: svgW,\r\n }}\r\n >\r\n {yTicks.map((tick) => (\r\n <PDFText\r\n key={`fallback-y-${tick}`}\r\n style={{\r\n ...labelStyle,\r\n left: 0,\r\n textAlign: \"right\",\r\n top: toY(tick) - 4,\r\n width: chartX - 4,\r\n }}\r\n >\r\n {fmtNum(tick)}\r\n </PDFText>\r\n ))}\r\n {(variant === \"line\" || variant === \"area\") &&\r\n xLabels.map((label, index) => (\r\n <PDFText\r\n key={`fallback-x-${label}`}\r\n style={{\r\n ...labelStyle,\r\n left: pointX(index) - 12,\r\n textAlign: \"center\",\r\n top: chartY + chartH + 3,\r\n width: 24,\r\n }}\r\n >\r\n {truncate(label, 8)}\r\n </PDFText>\r\n ))}\r\n {variant === \"bar\" &&\r\n showValues &&\r\n xLabels.flatMap((label, categoryIndex) =>\r\n series.map((item, seriesIndex) => {\r\n const value = item.data[categoryIndex]?.value ?? 0;\r\n const left =\r\n chartX +\r\n categoryIndex * groupWidth +\r\n barGap +\r\n seriesIndex * (barWidth + barGap);\r\n return (\r\n <PDFText\r\n key={`fallback-bar-${label}-${item.name}-${seriesIndex}`}\r\n style={{\r\n ...labelStyle,\r\n fontSize: 6,\r\n left,\r\n textAlign: \"center\",\r\n top: toY(value) - 8,\r\n width: barWidth,\r\n }}\r\n >\r\n {fmtNum(value)}\r\n </PDFText>\r\n );\r\n })\r\n )}\r\n </View>\r\n );\r\n};\r\n\r\nconst renderGraphContent = (\r\n title: string | undefined,\r\n subtitle: string | undefined,\r\n chartContent: React.ReactNode,\r\n chartLabels: React.ReactNode,\r\n axisLabels: React.ReactNode,\r\n textFallback: React.ReactNode,\r\n width: number,\r\n height: number,\r\n legend: string,\r\n showLegend: boolean,\r\n isPieOrDonut: boolean,\r\n series: GraphSeries[],\r\n palette: string[],\r\n styles: ReturnType<typeof createGraphStyles>\r\n) => (\r\n <>\r\n {title && <PDFText style={styles.title}>{title}</PDFText>}\r\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\r\n <View style={legend === \"right\" ? styles.chartWithRightLegend : undefined}>\r\n <View style={{ height, position: \"relative\", width }}>\r\n <Svg width={width} height={height}>\r\n {chartContent}\r\n {axisLabels}\r\n </Svg>\r\n {textFallback}\r\n </View>\r\n {showLegend &&\r\n legend === \"right\" &&\r\n Legend({ palette, position: \"right\", series, styles })}\r\n </View>\r\n {chartLabels}\r\n {showLegend &&\r\n legend === \"bottom\" &&\r\n Legend({ palette, position: \"bottom\", series, styles })}\r\n </>\r\n);\r\n\r\nconst renderBarLabels = (\r\n variant: GraphProps[\"variant\"],\r\n series: GraphSeries[],\r\n chartX: number,\r\n chartW: number\r\n) => {\r\n if (variant !== \"bar\") {\r\n return null;\r\n }\r\n\r\n return (\r\n <View\r\n style={{\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n marginLeft: chartX,\r\n width: chartW,\r\n }}\r\n >\r\n {(series[0]?.data ?? []).map((point) => (\r\n <View key={point.label} style={{ alignItems: \"center\", flex: 1 }}>\r\n <PDFText style={{ fontSize: 7 }}>{truncate(point.label, 10)}</PDFText>\r\n </View>\r\n ))}\r\n </View>\r\n );\r\n};\r\n\r\n/**\r\n * PdfGraph — renders bar, horizontal-bar, line, area, pie, and donut charts\r\n * natively inside react-pdf documents using SVG primitives.\r\n *\r\n * No external chart libraries are required or used — all rendering is done via\r\n * react-pdf's built-in SVG support (`<Svg>`, `<Rect>`, `<Path>`, `<Line>`, etc.).\r\n *\r\n * @example Bar chart\r\n * ```tsx\r\n * <PdfGraph\r\n * variant=\"bar\"\r\n * title=\"Monthly Revenue\"\r\n * data={[\r\n * { label: 'Jan', value: 42000 },\r\n * { label: 'Feb', value: 38000 },\r\n * { label: 'Mar', value: 55000 },\r\n * ]}\r\n * />\r\n * ```\r\n *\r\n * @example Donut chart with center label\r\n * ```tsx\r\n * <PdfGraph\r\n * variant=\"donut\"\r\n * data={[\r\n * { label: 'Product A', value: 45 },\r\n * { label: 'Product B', value: 30 },\r\n * { label: 'Other', value: 25 },\r\n * ]}\r\n * centerLabel=\"$1.2M\"\r\n * />\r\n * ```\r\n *\r\n * **Limitations (by design):**\r\n * - No interactivity (PDFs are static)\r\n * - No animations\r\n * - SVG Text inside charts uses SVG font attributes (not react-pdf StyleSheet fonts)\r\n * - For print PDFs use SVG-friendly fonts registered with Font.register()\r\n */\r\nexport const PdfGraph = ({\r\n variant = \"bar\",\r\n data,\r\n title,\r\n subtitle,\r\n xLabel,\r\n yLabel,\r\n width: explicitWidth,\r\n height = 260,\r\n fullWidth = false,\r\n containerPadding = 0,\r\n wrapperPadding = 0,\r\n colors,\r\n showValues = false,\r\n showGrid = true,\r\n legend = \"bottom\",\r\n centerLabel,\r\n showDots = true,\r\n smooth = false,\r\n yTicks: yTickCount = 5,\r\n noWrap = true,\r\n style,\r\n}: GraphProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createGraphStyles(theme), [theme]);\r\n const palette = colors ?? getDefaultPalette(theme);\r\n const series = normalizeData(data);\r\n\r\n const width = useSafeMemo(() => {\r\n if (fullWidth) {\r\n return getGraphWidth(theme, { containerPadding, wrapperPadding });\r\n }\r\n return explicitWidth ?? GRAPH_SAFE_WIDTHS.default;\r\n }, [fullWidth, explicitWidth, theme, containerPadding, wrapperPadding]);\r\n\r\n const isPieOrDonut = variant === \"pie\" || variant === \"donut\";\r\n const layout = buildLayout(series, width, height, isPieOrDonut, yTickCount);\r\n const { chartX, chartW } = layout;\r\n\r\n const chartContent = renderChartContent(\r\n variant,\r\n series,\r\n layout,\r\n palette,\r\n showGrid,\r\n showValues,\r\n showDots,\r\n smooth,\r\n centerLabel,\r\n theme\r\n );\r\n\r\n const showLegend = legend !== \"none\" && !isPieOrDonut;\r\n const chartLabels = renderBarLabels(variant, series, chartX, chartW);\r\n\r\n const containerStyles: Style[] = [styles.container];\r\n if (style) {\r\n containerStyles.push(style);\r\n }\r\n\r\n const content = (\r\n <View style={containerStyles as never}>\r\n {renderGraphContent(\r\n title,\r\n subtitle,\r\n chartContent,\r\n chartLabels,\r\n renderAxisLabels(\r\n isPieOrDonut,\r\n xLabel,\r\n yLabel,\r\n chartX,\r\n chartW,\r\n height,\r\n theme.colors.mutedForeground\r\n ),\r\n renderTextFallback(\r\n variant,\r\n series,\r\n layout,\r\n showValues,\r\n theme.colors.mutedForeground\r\n ),\r\n width,\r\n height,\r\n legend,\r\n showLegend,\r\n isPieOrDonut,\r\n series,\r\n palette,\r\n styles\r\n )}\r\n </View>\r\n );\r\n\r\n return noWrap ? <View wrap={false}>{content}</View> : content;\r\n};\r\n",
+ "content": "import type React from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Text as PDFText,\n View,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport {\n Circle,\n G,\n Line,\n Path,\n Rect,\n Svg,\n SvgText,\n} from \"@/lib/pdf-svg\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport { createGraphStyles } from \"./graph.styles\";\nimport type { ChartLayout, GraphProps, GraphSeries } from \"./graph.types\";\nimport {\n GRAPH_SAFE_WIDTHS,\n arcPath,\n buildLayout,\n fmtNum,\n getDefaultPalette,\n getGraphWidth,\n normalizeData,\n polarToCartesian,\n smoothPath,\n truncate,\n} from \"./graph.utils\";\n\n/**\n * Shared Y-axis grid lines and tick labels for cartesian charts (bar, line, area).\n * Extracted to avoid duplicating the identical block across render functions.\n */\nconst renderGridAndYAxis = (\n ticks: number[],\n toY: (v: number) => number,\n chartX: number,\n chartW: number,\n showGrid: boolean,\n gridColor: string,\n textColor: string\n) => (\n <>\n {ticks.map((tick) => {\n const ty = toY(tick);\n return (\n <G key={`grid-${tick}`}>\n {showGrid && (\n <Line\n x1={chartX}\n y1={ty}\n x2={chartX + chartW}\n y2={ty}\n stroke={gridColor}\n strokeWidth={0.5}\n strokeDasharray=\"3 3\"\n />\n )}\n <SvgText\n x={chartX - 4}\n y={ty + 3}\n fill={textColor}\n textAnchor=\"end\"\n style={{ fontSize: 7 }}\n >\n {fmtNum(tick)}\n </SvgText>\n </G>\n );\n })}\n </>\n);\n\nconst renderBarChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showGrid: boolean,\n showValues: boolean,\n theme: PdfcnTheme\n) => {\n const { chartX, chartY, chartW, chartH, yMin, yMax, yTicks, xLabels } =\n layout;\n const nCategories = xLabels.length;\n const nSeries = series.length;\n const groupGap = 0.25;\n const groupW = chartW / nCategories;\n const barW = (groupW * (1 - groupGap)) / nSeries;\n const textColor = theme.colors.mutedForeground;\n const gridColor = theme.colors.border;\n const axisColor = theme.colors.foreground;\n const range = yMax - yMin || 1;\n const toY = (v: number) => chartY + chartH - ((v - yMin) / range) * chartH;\n\n return (\n <>\n {renderGridAndYAxis(\n yTicks,\n toY,\n chartX,\n chartW,\n showGrid,\n gridColor,\n textColor\n )}\n\n <Line\n x1={chartX}\n y1={chartY + chartH}\n x2={chartX + chartW}\n y2={chartY + chartH}\n stroke={axisColor}\n strokeWidth={1}\n />\n\n {xLabels.map((label, ci) => {\n const groupLeft = chartX + ci * groupW + groupW * (groupGap / 2);\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`group-${ci}`}>\n {series.map((s, si) => {\n const val = s.data[ci]?.value ?? 0;\n const color =\n s.data[ci]?.color ?? s.color ?? palette[si % palette.length];\n const barH = ((val - yMin) / range) * chartH;\n const bx = groupLeft + si * barW;\n const by = chartY + chartH - barH;\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`bar-${ci}-${si}`}>\n <Rect\n x={bx}\n y={by}\n width={barW - 1}\n height={barH}\n fill={color}\n />\n {showValues && barH > 10 && (\n <SvgText\n x={bx + barW / 2 - 0.5}\n y={by - 2}\n fill={axisColor}\n textAnchor=\"middle\"\n style={{ fontSize: 6 }}\n >\n {fmtNum(val)}\n </SvgText>\n )}\n </G>\n );\n })}\n <SvgText\n x={groupLeft + (nSeries * barW) / 2}\n y={chartY + chartH + 10}\n fill={textColor}\n textAnchor=\"middle\"\n style={{ fontSize: 7 }}\n >\n {truncate(label, 10)}\n </SvgText>\n </G>\n );\n })}\n </>\n );\n};\n\nconst renderHorizontalBarChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showValues: boolean,\n theme: PdfcnTheme\n) => {\n const { chartX, chartY, chartW, chartH, xLabels } = layout;\n const nCategories = xLabels.length;\n const allValues = series.flatMap((s) => s.data.map((d) => d.value));\n const maxVal = Math.max(...allValues, 1);\n const rowH = chartH / nCategories;\n const barH = rowH * 0.5;\n const textColor = theme.colors.mutedForeground;\n const axisColor = theme.colors.foreground;\n const labelW = 60;\n\n return (\n <>\n {xLabels.map((label, ci) => {\n const rowY = chartY + ci * rowH;\n const val = series[0]?.data[ci]?.value ?? 0;\n const color =\n series[0]?.data[ci]?.color ??\n series[0]?.color ??\n palette[ci % palette.length];\n const barW = (val / maxVal) * (chartW - labelW);\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`hbar-${ci}`}>\n <SvgText\n x={chartX + labelW - 4}\n y={rowY + rowH / 2 + 3}\n fill={textColor}\n textAnchor=\"end\"\n style={{ fontSize: 7 }}\n >\n {truncate(label, 14)}\n </SvgText>\n <Rect\n x={chartX + labelW}\n y={rowY + (rowH - barH) / 2}\n width={Math.max(barW, 1)}\n height={barH}\n fill={color}\n />\n {showValues && (\n <SvgText\n x={chartX + labelW + barW + 3}\n y={rowY + rowH / 2 + 3}\n fill={axisColor}\n textAnchor=\"start\"\n style={{ fontSize: 6 }}\n >\n {fmtNum(val)}\n </SvgText>\n )}\n </G>\n );\n })}\n <Line\n x1={chartX + labelW}\n y1={chartY}\n x2={chartX + labelW}\n y2={chartY + chartH}\n stroke={axisColor}\n strokeWidth={1}\n />\n </>\n );\n};\n\nconst renderLineAreaChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showGrid: boolean,\n showValues: boolean,\n showDots: boolean,\n smooth: boolean,\n isArea: boolean,\n theme: PdfcnTheme\n) => {\n const { chartX, chartY, chartW, chartH, yMin, yMax, yTicks, xLabels } =\n layout;\n const range = yMax - yMin || 1;\n const textColor = theme.colors.mutedForeground;\n const gridColor = theme.colors.border;\n const axisColor = theme.colors.foreground;\n const nPoints = xLabels.length;\n\n const xFor = (i: number) => chartX + (i / Math.max(nPoints - 1, 1)) * chartW;\n const yFor = (v: number) => chartY + chartH - ((v - yMin) / range) * chartH;\n\n return (\n <>\n {renderGridAndYAxis(\n yTicks,\n yFor,\n chartX,\n chartW,\n showGrid,\n gridColor,\n textColor\n )}\n\n <Line\n x1={chartX}\n y1={chartY + chartH}\n x2={chartX + chartW}\n y2={chartY + chartH}\n stroke={axisColor}\n strokeWidth={1}\n />\n\n {series.map((s, si) => {\n const color = s.color ?? palette[si % palette.length];\n const points = s.data.map((d, i) => ({ x: xFor(i), y: yFor(d.value) }));\n\n const lineDStr = smooth\n ? smoothPath(points)\n : `M ${points.map((p) => `${p.x} ${p.y}`).join(\" L \")}`;\n\n const lastPoint = points.at(-1);\n const firstPoint = points.at(0);\n const areaPath =\n isArea && points.length > 1 && lastPoint && firstPoint\n ? `${lineDStr} L ${lastPoint.x} ${chartY + chartH} L ${firstPoint.x} ${chartY + chartH} Z`\n : null;\n\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`series-${si}`}>\n {isArea && areaPath && (\n <Path d={areaPath} fill={color} fillOpacity={0.2} stroke=\"none\" />\n )}\n <Path d={lineDStr} stroke={color} strokeWidth={2} fill=\"none\" />\n {showDots &&\n points.map((p, pi) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <Circle\n key={`dot-${pi}`}\n cx={p.x}\n cy={p.y}\n r={3}\n fill={color}\n />\n ))}\n {showValues &&\n points.map((p, pi) => (\n <SvgText\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n key={`val-${pi}`}\n x={p.x}\n y={p.y - 5}\n fill={color}\n textAnchor=\"middle\"\n style={{ fontSize: 6 }}\n >\n {fmtNum(s.data[pi].value)}\n </SvgText>\n ))}\n </G>\n );\n })}\n\n {xLabels.map((label, i) => (\n <SvgText\n key={`xlabel-${label}`}\n x={xFor(i)}\n y={chartY + chartH + 10}\n fill={textColor}\n textAnchor=\"middle\"\n style={{ fontSize: 7 }}\n >\n {truncate(label, 8)}\n </SvgText>\n ))}\n </>\n );\n};\n\nconst renderPieDonutChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n centerLabel: string | undefined,\n isDonut: boolean,\n theme: PdfcnTheme\n) => {\n const { svgW, svgH } = layout;\n const cx = svgW / 2;\n const cy = svgH / 2;\n const r = Math.min(svgW, svgH) / 2 - 20;\n const innerR = isDonut ? r * 0.52 : 0;\n const textColor = theme.colors.mutedForeground;\n\n const data = series[0]?.data ?? [];\n const total = data.reduce((sum, d) => sum + d.value, 0) || 1;\n\n let currentAngle = 0;\n\n return (\n <>\n {data.map((d, i) => {\n const color = d.color ?? palette[i % palette.length];\n const sweep = (d.value / total) * 360;\n const midAngle = currentAngle + sweep / 2;\n const path = arcPath(\n cx,\n cy,\n r,\n currentAngle,\n currentAngle + sweep,\n innerR\n );\n currentAngle += sweep;\n\n const labelR = r * 1.18;\n const lp = polarToCartesian(cx, cy, labelR, midAngle);\n const anchor = lp.x > cx ? \"start\" : \"end\";\n\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`slice-${i}`}>\n <Path d={path} fill={color} stroke=\"white\" strokeWidth={1} />\n {/* Show label only if slice is large enough to label */}\n {sweep > 15 && (\n <SvgText\n x={lp.x}\n y={lp.y + 3}\n fill={textColor}\n textAnchor={anchor}\n style={{ fontSize: 7 }}\n >\n {truncate(d.label, 10)}\n </SvgText>\n )}\n </G>\n );\n })}\n\n {isDonut && centerLabel && (\n <>\n <Circle cx={cx} cy={cy} r={innerR} fill=\"white\" />\n <SvgText\n x={cx}\n y={cy + 4}\n fill={theme.colors.foreground}\n textAnchor=\"middle\"\n style={{ fontSize: 9, fontWeight: \"bold\" }}\n >\n {centerLabel}\n </SvgText>\n </>\n )}\n </>\n );\n};\n\nconst Legend = ({\n series,\n palette,\n styles,\n position = \"bottom\",\n}: {\n series: GraphSeries[];\n palette: string[];\n styles: ReturnType<typeof createGraphStyles>;\n position?: \"bottom\" | \"right\";\n}) => {\n const containerStyle =\n position === \"right\" ? styles.legendColumn : styles.legendRow;\n\n return (\n <View style={containerStyle as never}>\n {series.map((s, i) => (\n <View key={s.name} style={styles.legendItem}>\n <Svg width={10} height={10}>\n <Rect\n x={0}\n y={2}\n width={8}\n height={8}\n fill={s.color ?? palette[i % palette.length]}\n />\n </Svg>\n <PDFText style={styles.legendText}>{s.name}</PDFText>\n </View>\n ))}\n </View>\n );\n};\n\nconst renderChartContent = (\n variant: string,\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showGrid: boolean,\n showValues: boolean,\n showDots: boolean,\n smooth: boolean,\n centerLabel: string | undefined,\n theme: PdfcnTheme\n): React.ReactNode => {\n switch (variant) {\n case \"bar\": {\n return renderBarChart(\n series,\n layout,\n palette,\n showGrid,\n showValues,\n theme\n );\n }\n case \"horizontal-bar\": {\n return renderHorizontalBarChart(\n series,\n layout,\n palette,\n showValues,\n theme\n );\n }\n case \"line\":\n case \"area\": {\n return renderLineAreaChart(\n series,\n layout,\n palette,\n showGrid,\n showValues,\n showDots,\n smooth,\n variant === \"area\",\n theme\n );\n }\n case \"pie\": {\n return renderPieDonutChart(\n series,\n layout,\n palette,\n undefined,\n false,\n theme\n );\n }\n case \"donut\": {\n return renderPieDonutChart(\n series,\n layout,\n palette,\n centerLabel,\n true,\n theme\n );\n }\n default: {\n return null;\n }\n }\n};\n\nconst renderAxisLabels = (\n isPieOrDonut: boolean,\n xLabel: string | undefined,\n yLabel: string | undefined,\n chartX: number,\n chartW: number,\n height: number,\n mutedForeground: string\n) => (\n <>\n {!isPieOrDonut && xLabel && (\n <SvgText\n x={chartX + chartW / 2}\n y={height - 2}\n fill={mutedForeground}\n textAnchor=\"middle\"\n style={{ fontSize: 8 }}\n >\n {xLabel}\n </SvgText>\n )}\n {!isPieOrDonut && yLabel && (\n <SvgText\n x={2}\n y={10}\n fill={mutedForeground}\n textAnchor=\"start\"\n style={{ fontSize: 8 }}\n >\n {yLabel}\n </SvgText>\n )}\n </>\n);\n\nconst renderTextFallback = (\n variant: GraphProps[\"variant\"],\n series: GraphSeries[],\n layout: ChartLayout,\n showValues: boolean,\n textColor: string\n) => {\n if (variant === \"pie\" || variant === \"donut\") {\n const data = series[0]?.data ?? [];\n const total = data.reduce((sum, point) => sum + point.value, 0) || 1;\n const cx = layout.svgW / 2;\n const cy = layout.svgH / 2;\n const radius = Math.min(layout.svgW, layout.svgH) / 2 - 20;\n const labelRadius = radius * 1.18;\n let currentAngle = 0;\n\n return (\n <View\n style={{\n height: layout.svgH,\n left: 0,\n position: \"absolute\",\n top: 0,\n width: layout.svgW,\n }}\n >\n {data.map((point, index) => {\n const sweep = (point.value / total) * 360;\n const midAngle = currentAngle + sweep / 2;\n currentAngle += sweep;\n if (sweep <= 15) {\n return null;\n }\n const labelPoint = polarToCartesian(cx, cy, labelRadius, midAngle);\n const onRight = labelPoint.x > cx;\n return (\n <PDFText\n key={`fallback-pie-${point.label}-${index}`}\n style={{\n color: textColor,\n fontSize: 7,\n left: onRight ? labelPoint.x : labelPoint.x - 60,\n lineHeight: 1,\n position: \"absolute\",\n textAlign: onRight ? \"left\" : \"right\",\n top: labelPoint.y - 4,\n width: 60,\n }}\n >\n {truncate(point.label, 10)}\n </PDFText>\n );\n })}\n </View>\n );\n }\n\n const {\n chartH,\n chartW,\n chartX,\n chartY,\n svgH,\n svgW,\n xLabels,\n yMax,\n yMin,\n yTicks,\n } = layout;\n const range = yMax - yMin || 1;\n const toY = (value: number) =>\n chartY + chartH - ((value - yMin) / range) * chartH;\n const labelStyle = {\n color: textColor,\n fontSize: 7,\n lineHeight: 1,\n position: \"absolute\" as const,\n };\n\n if (variant === \"horizontal-bar\") {\n const labelWidth = 60;\n const rowHeight = chartH / Math.max(xLabels.length, 1);\n const maxValue = Math.max(\n ...series.flatMap((item) => item.data.map((point) => point.value)),\n 1\n );\n\n return (\n <View\n style={{\n height: svgH,\n left: 0,\n position: \"absolute\",\n top: 0,\n width: svgW,\n }}\n >\n {xLabels.map((label, index) => {\n const value = series[0]?.data[index]?.value ?? 0;\n const barWidth = (value / maxValue) * (chartW - labelWidth);\n return (\n <View key={`fallback-horizontal-${label}`}>\n <PDFText\n style={{\n ...labelStyle,\n left: chartX,\n textAlign: \"right\",\n top: chartY + index * rowHeight + rowHeight / 2 - 4,\n width: labelWidth - 4,\n }}\n >\n {truncate(label, 14)}\n </PDFText>\n {showValues ? (\n <PDFText\n style={{\n ...labelStyle,\n color: textColor,\n fontSize: 6,\n left: chartX + labelWidth + barWidth + 3,\n top: chartY + index * rowHeight + rowHeight / 2 - 4,\n width: 28,\n }}\n >\n {fmtNum(value)}\n </PDFText>\n ) : null}\n </View>\n );\n })}\n </View>\n );\n }\n\n const pointX = (index: number) =>\n chartX + (index / Math.max(xLabels.length - 1, 1)) * chartW;\n const groupWidth = chartW / Math.max(xLabels.length, 1);\n const barGap = 2;\n const barWidth = Math.max(\n (groupWidth - barGap * (series.length + 1)) / Math.max(series.length, 1),\n 1\n );\n\n return (\n <View\n style={{\n height: svgH,\n left: 0,\n position: \"absolute\",\n top: 0,\n width: svgW,\n }}\n >\n {yTicks.map((tick) => (\n <PDFText\n key={`fallback-y-${tick}`}\n style={{\n ...labelStyle,\n left: 0,\n textAlign: \"right\",\n top: toY(tick) - 4,\n width: chartX - 4,\n }}\n >\n {fmtNum(tick)}\n </PDFText>\n ))}\n {(variant === \"line\" || variant === \"area\") &&\n xLabels.map((label, index) => (\n <PDFText\n key={`fallback-x-${label}`}\n style={{\n ...labelStyle,\n left: pointX(index) - 12,\n textAlign: \"center\",\n top: chartY + chartH + 3,\n width: 24,\n }}\n >\n {truncate(label, 8)}\n </PDFText>\n ))}\n {variant === \"bar\" &&\n showValues &&\n xLabels.flatMap((label, categoryIndex) =>\n series.map((item, seriesIndex) => {\n const value = item.data[categoryIndex]?.value ?? 0;\n const left =\n chartX +\n categoryIndex * groupWidth +\n barGap +\n seriesIndex * (barWidth + barGap);\n return (\n <PDFText\n key={`fallback-bar-${label}-${item.name}-${seriesIndex}`}\n style={{\n ...labelStyle,\n fontSize: 6,\n left,\n textAlign: \"center\",\n top: toY(value) - 8,\n width: barWidth,\n }}\n >\n {fmtNum(value)}\n </PDFText>\n );\n })\n )}\n </View>\n );\n};\n\nconst renderGraphContent = (\n title: string | undefined,\n subtitle: string | undefined,\n chartContent: React.ReactNode,\n chartLabels: React.ReactNode,\n axisLabels: React.ReactNode,\n textFallback: React.ReactNode,\n width: number,\n height: number,\n legend: string,\n showLegend: boolean,\n isPieOrDonut: boolean,\n series: GraphSeries[],\n palette: string[],\n styles: ReturnType<typeof createGraphStyles>\n) => (\n <>\n {title && <PDFText style={styles.title}>{title}</PDFText>}\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n <View style={legend === \"right\" ? styles.chartWithRightLegend : undefined}>\n <View style={{ height, position: \"relative\", width }}>\n <Svg width={width} height={height}>\n {chartContent}\n {axisLabels}\n </Svg>\n {textFallback}\n </View>\n {showLegend &&\n legend === \"right\" &&\n Legend({ palette, position: \"right\", series, styles })}\n </View>\n {chartLabels}\n {showLegend &&\n legend === \"bottom\" &&\n Legend({ palette, position: \"bottom\", series, styles })}\n </>\n);\n\nconst renderBarLabels = (\n variant: GraphProps[\"variant\"],\n series: GraphSeries[],\n chartX: number,\n chartW: number\n) => {\n if (variant !== \"bar\") {\n return null;\n }\n\n return (\n <View\n style={{\n display: \"flex\",\n flexDirection: \"row\",\n marginLeft: chartX,\n width: chartW,\n }}\n >\n {(series[0]?.data ?? []).map((point) => (\n <View key={point.label} style={{ alignItems: \"center\", flex: 1 }}>\n <PDFText style={{ fontSize: 7 }}>{truncate(point.label, 10)}</PDFText>\n </View>\n ))}\n </View>\n );\n};\n\n/**\n * PdfGraph — renders bar, horizontal-bar, line, area, pie, and donut charts\n * natively inside react-pdf documents using SVG primitives.\n *\n * No external chart libraries are required or used — all rendering is done via\n * react-pdf's built-in SVG support (`<Svg>`, `<Rect>`, `<Path>`, `<Line>`, etc.).\n *\n * @example Bar chart\n * ```tsx\n * <PdfGraph\n * variant=\"bar\"\n * title=\"Monthly Revenue\"\n * data={[\n * { label: 'Jan', value: 42000 },\n * { label: 'Feb', value: 38000 },\n * { label: 'Mar', value: 55000 },\n * ]}\n * />\n * ```\n *\n * @example Donut chart with center label\n * ```tsx\n * <PdfGraph\n * variant=\"donut\"\n * data={[\n * { label: 'Product A', value: 45 },\n * { label: 'Product B', value: 30 },\n * { label: 'Other', value: 25 },\n * ]}\n * centerLabel=\"$1.2M\"\n * />\n * ```\n *\n * **Limitations (by design):**\n * - No interactivity (PDFs are static)\n * - No animations\n * - SVG Text inside charts uses SVG font attributes (not react-pdf StyleSheet fonts)\n * - For print PDFs use SVG-friendly fonts registered with Font.register()\n */\nexport const PdfGraph = ({\n variant = \"bar\",\n data,\n title,\n subtitle,\n xLabel,\n yLabel,\n width: explicitWidth,\n height = 260,\n fullWidth = false,\n containerPadding = 0,\n wrapperPadding = 0,\n colors,\n showValues = false,\n showGrid = true,\n legend = \"bottom\",\n centerLabel,\n showDots = true,\n smooth = false,\n yTicks: yTickCount = 5,\n noWrap = true,\n style,\n}: GraphProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createGraphStyles(theme), [theme]);\n const palette = colors ?? getDefaultPalette(theme);\n const series = normalizeData(data);\n\n const width = useSafeMemo(() => {\n if (fullWidth) {\n return getGraphWidth(theme, { containerPadding, wrapperPadding });\n }\n return explicitWidth ?? GRAPH_SAFE_WIDTHS.default;\n }, [fullWidth, explicitWidth, theme, containerPadding, wrapperPadding]);\n\n const isPieOrDonut = variant === \"pie\" || variant === \"donut\";\n const layout = buildLayout(series, width, height, isPieOrDonut, yTickCount);\n const { chartX, chartW } = layout;\n\n const chartContent = renderChartContent(\n variant,\n series,\n layout,\n palette,\n showGrid,\n showValues,\n showDots,\n smooth,\n centerLabel,\n theme\n );\n\n const showLegend = legend !== \"none\" && !isPieOrDonut;\n const chartLabels = renderBarLabels(variant, series, chartX, chartW);\n\n const containerStyles: Style[] = [styles.container];\n if (style) {\n containerStyles.push(style);\n }\n\n const content = (\n <View style={containerStyles as never}>\n {renderGraphContent(\n title,\n subtitle,\n chartContent,\n chartLabels,\n renderAxisLabels(\n isPieOrDonut,\n xLabel,\n yLabel,\n chartX,\n chartW,\n height,\n theme.colors.mutedForeground\n ),\n renderTextFallback(\n variant,\n series,\n layout,\n showValues,\n theme.colors.mutedForeground\n ),\n width,\n height,\n legend,\n showLegend,\n isPieOrDonut,\n series,\n palette,\n styles\n )}\n </View>\n );\n\n return noWrap ? <View wrap={false}>{content}</View> : content;\n};\n",
"type": "registry:component",
"target": "components/pdf/graph/graph.tsx"
},
{
"path": "registry/bases/forme/components/graph/graph.types.ts",
- "content": "import type { Style } from \"@formepdf/react\";\r\n\r\n/**\r\n * Options for calculating graph width based on theme page margins and container context.\r\n * Props - `containerPadding` | `wrapperPadding` | `pageWidth`\r\n * @see {@link GraphWidthOptions}\r\n */\r\nexport interface GraphWidthOptions {\r\n containerPadding?: number;\r\n wrapperPadding?: number;\r\n pageWidth?: number;\r\n}\r\n\r\nexport type GraphVariant =\r\n | \"bar\"\r\n | \"horizontal-bar\"\r\n | \"line\"\r\n | \"area\"\r\n | \"pie\"\r\n | \"donut\";\r\n\r\nexport type GraphLegendPosition = \"bottom\" | \"right\" | \"none\";\r\n\r\n/**\r\n * A single data point with a label, numeric value, and optional color override.\r\n * Props - `label` | `value` | `color`\r\n * @see {@link GraphDataPoint}\r\n */\r\nexport interface GraphDataPoint {\r\n label: string;\r\n value: number;\r\n color?: string;\r\n}\r\n\r\n/**\r\n * A named data series containing multiple data points, used for multi-series charts.\r\n * Props - `name` | `data` | `color`\r\n * @see {@link GraphSeries}\r\n */\r\nexport interface GraphSeries {\r\n name: string;\r\n data: GraphDataPoint[];\r\n color?: string;\r\n}\r\n\r\n/**\r\n * Multi-variant PDF chart (bar, line, area, pie, donut) rendered with SVG primitives.\r\n * Props - `variant` | `data` | `title` | `subtitle` | `xLabel` | `yLabel` | `width` | `height` | `fullWidth` | `containerPadding` | `wrapperPadding` | `colors` | `showValues` | `showGrid` | `legend` | `centerLabel` | `showDots` | `smooth` | `yTicks` | `noWrap` | `style`\r\n * @see {@link GraphProps}\r\n */\r\nexport interface GraphProps {\r\n /**\r\n * @default 'bar'\r\n */\r\n variant?: GraphVariant;\r\n data: GraphDataPoint[] | GraphSeries[];\r\n title?: string;\r\n subtitle?: string;\r\n xLabel?: string;\r\n yLabel?: string;\r\n /**\r\n * @default 420\r\n */\r\n width?: number;\r\n /**\r\n * @default 260\r\n */\r\n height?: number;\r\n /**\r\n * @default false\r\n */\r\n fullWidth?: boolean;\r\n containerPadding?: number;\r\n wrapperPadding?: number;\r\n colors?: string[];\r\n /**\r\n * @default false\r\n */\r\n showValues?: boolean;\r\n /**\r\n * @default true\r\n */\r\n showGrid?: boolean;\r\n /**\r\n * @default 'bottom'\r\n */\r\n legend?: GraphLegendPosition;\r\n centerLabel?: string;\r\n /**\r\n * @default true\r\n */\r\n showDots?: boolean;\r\n /**\r\n * @default false\r\n */\r\n smooth?: boolean;\r\n /**\r\n * @default 5\r\n */\r\n yTicks?: number;\r\n /**\r\n * @default true\r\n */\r\n noWrap?: boolean;\r\n style?: Style;\r\n}\r\n\r\n/** Internal chart layout dimensions computed from props and data. */\r\nexport interface ChartLayout {\r\n svgW: number;\r\n svgH: number;\r\n chartX: number;\r\n chartY: number;\r\n chartW: number;\r\n chartH: number;\r\n yMin: number;\r\n yMax: number;\r\n yTicks: number[];\r\n xLabels: string[];\r\n}\r\n",
+ "content": "import type { Style } from \"@formepdf/react\";\n\n/**\n * Options for calculating graph width based on theme page margins and container context.\n * Props - `containerPadding` | `wrapperPadding` | `pageWidth`\n * @see {@link GraphWidthOptions}\n */\nexport interface GraphWidthOptions {\n containerPadding?: number;\n wrapperPadding?: number;\n pageWidth?: number;\n}\n\nexport type GraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\nexport type GraphLegendPosition = \"bottom\" | \"right\" | \"none\";\n\n/**\n * A single data point with a label, numeric value, and optional color override.\n * Props - `label` | `value` | `color`\n * @see {@link GraphDataPoint}\n */\nexport interface GraphDataPoint {\n label: string;\n value: number;\n color?: string;\n}\n\n/**\n * A named data series containing multiple data points, used for multi-series charts.\n * Props - `name` | `data` | `color`\n * @see {@link GraphSeries}\n */\nexport interface GraphSeries {\n name: string;\n data: GraphDataPoint[];\n color?: string;\n}\n\n/**\n * Multi-variant PDF chart (bar, line, area, pie, donut) rendered with SVG primitives.\n * Props - `variant` | `data` | `title` | `subtitle` | `xLabel` | `yLabel` | `width` | `height` | `fullWidth` | `containerPadding` | `wrapperPadding` | `colors` | `showValues` | `showGrid` | `legend` | `centerLabel` | `showDots` | `smooth` | `yTicks` | `noWrap` | `style`\n * @see {@link GraphProps}\n */\nexport interface GraphProps {\n /**\n * @default 'bar'\n */\n variant?: GraphVariant;\n data: GraphDataPoint[] | GraphSeries[];\n title?: string;\n subtitle?: string;\n xLabel?: string;\n yLabel?: string;\n /**\n * @default 420\n */\n width?: number;\n /**\n * @default 260\n */\n height?: number;\n /**\n * @default false\n */\n fullWidth?: boolean;\n containerPadding?: number;\n wrapperPadding?: number;\n colors?: string[];\n /**\n * @default false\n */\n showValues?: boolean;\n /**\n * @default true\n */\n showGrid?: boolean;\n /**\n * @default 'bottom'\n */\n legend?: GraphLegendPosition;\n centerLabel?: string;\n /**\n * @default true\n */\n showDots?: boolean;\n /**\n * @default false\n */\n smooth?: boolean;\n /**\n * @default 5\n */\n yTicks?: number;\n /**\n * @default true\n */\n noWrap?: boolean;\n style?: Style;\n}\n\n/** Internal chart layout dimensions computed from props and data. */\nexport interface ChartLayout {\n svgW: number;\n svgH: number;\n chartX: number;\n chartY: number;\n chartW: number;\n chartH: number;\n yMin: number;\n yMax: number;\n yTicks: number[];\n xLabels: string[];\n}\n",
"type": "registry:component",
"target": "components/pdf/graph/graph.types.ts"
},
{
"path": "registry/bases/forme/components/graph/graph.utils.ts",
- "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type {\r\n ChartLayout,\r\n GraphDataPoint,\r\n GraphSeries,\r\n GraphWidthOptions,\r\n} from \"./graph.types\";\r\n\r\n/** Standard A4 page width in PDF points. */\r\nexport const A4_WIDTH = 595;\r\n\r\n/**\r\n * Pre-calculated safe graph widths for common scenarios.\r\n * These values work with all built-in themes on A4 pages.\r\n */\r\nexport const GRAPH_SAFE_WIDTHS = {\r\n /** Safe width for graph directly in page content (no extra containers) */\r\n default: 420,\r\n /** Safe width for graph inside a Section with md padding */\r\n inSection: 400,\r\n /** Safe width for graph inside a Section + bordered wrapper (like graphShell) */\r\n inSectionWithWrapper: 380,\r\n} as const;\r\n\r\n/**\r\n * Calculate the safe graph width based on theme page margins and container context.\r\n *\r\n * This utility ensures graphs don't overflow their container by accounting for:\r\n * - Page margins (from theme)\r\n * - Container padding (e.g., Section component)\r\n * - Wrapper padding (e.g., a bordered graphShell View)\r\n *\r\n * @example\r\n * ```tsx\r\n * const width = getGraphWidth(theme);\r\n * // For a graph inside a Section with padding=\"md\" (12pt) and a graphShell (12pt):\r\n * const width = getGraphWidth(theme, { containerPadding: 12, wrapperPadding: 12 });\r\n * ```\r\n */\r\nexport const getGraphWidth = (\r\n theme: PdfcnTheme,\r\n options: GraphWidthOptions = {}\r\n): number => {\r\n const {\r\n containerPadding = 0,\r\n wrapperPadding = 0,\r\n pageWidth = A4_WIDTH,\r\n } = options;\r\n const { marginLeft, marginRight } = theme.spacing.page;\r\n const availableWidth =\r\n pageWidth -\r\n marginLeft -\r\n marginRight -\r\n containerPadding * 2 -\r\n wrapperPadding * 2;\r\n return Math.max(Math.floor(availableWidth), 100);\r\n};\r\n\r\nexport const CHART_MARGINS = {\r\n axisBottom: 24,\r\n axisLeft: 40,\r\n pieBottom: 10,\r\n pieLeft: 10,\r\n right: 10,\r\n top: 10,\r\n} as const;\r\n\r\n/** Normalize to always work with GraphSeries[]. */\r\nexport const normalizeData = (\r\n data: GraphDataPoint[] | GraphSeries[]\r\n): GraphSeries[] => {\r\n if (data.length === 0) {\r\n return [];\r\n }\r\n if (\"label\" in data[0] && \"value\" in data[0]) {\r\n return [{ data: data as GraphDataPoint[], name: \"Series 1\" }];\r\n }\r\n return data as GraphSeries[];\r\n};\r\n\r\n/** Compute nice Y-axis ticks for a given value range. */\r\nexport const computeYTicks = (\r\n min: number,\r\n max: number,\r\n count: number\r\n): number[] => {\r\n if (min === max) {\r\n return [0, max || 1];\r\n }\r\n const step = (max - min) / (count - 1);\r\n return Array.from({ length: count }, (_, i) => {\r\n const v = min + i * step;\r\n return Math.round(v * 100) / 100;\r\n });\r\n};\r\n\r\n/** Format a number for display on axis labels. */\r\nexport const fmtNum = (v: number): string => {\r\n if (Math.abs(v) >= 1_000_000) {\r\n return `${(v / 1_000_000).toFixed(1)}M`;\r\n }\r\n if (Math.abs(v) >= 1000) {\r\n return `${(v / 1000).toFixed(1)}K`;\r\n }\r\n if (!Number.isInteger(v)) {\r\n return v.toFixed(1);\r\n }\r\n return String(v);\r\n};\r\n\r\n/** Truncate a label to at most maxLen characters. */\r\nexport const truncate = (s: string, maxLen: number): string =>\r\n s.length > maxLen ? `${s.slice(0, maxLen - 1)}…` : s;\r\n\r\n/** Polar to Cartesian coordinate conversion for pie/donut arcs. */\r\nexport const polarToCartesian = (\r\n cx: number,\r\n cy: number,\r\n r: number,\r\n angleDeg: number\r\n) => {\r\n const rad = ((angleDeg - 90) * Math.PI) / 180;\r\n return { x: cx + r * Math.cos(rad), y: cy + r * Math.sin(rad) };\r\n};\r\n\r\n/** Build an SVG arc path for a pie/donut slice. */\r\nexport const arcPath = (\r\n cx: number,\r\n cy: number,\r\n r: number,\r\n startAngle: number,\r\n endAngle: number,\r\n innerR = 0\r\n): string => {\r\n const safeEnd = Math.min(endAngle, startAngle + 359.999);\r\n const large = safeEnd - startAngle > 180 ? 1 : 0;\r\n const s = polarToCartesian(cx, cy, r, safeEnd);\r\n const e = polarToCartesian(cx, cy, r, startAngle);\r\n if (innerR === 0) {\r\n return `M ${cx} ${cy} L ${s.x} ${s.y} A ${r} ${r} 0 ${large} 0 ${e.x} ${e.y} Z`;\r\n }\r\n const si = polarToCartesian(cx, cy, innerR, safeEnd);\r\n const ei = polarToCartesian(cx, cy, innerR, startAngle);\r\n return [\r\n `M ${s.x} ${s.y}`,\r\n `A ${r} ${r} 0 ${large} 0 ${e.x} ${e.y}`,\r\n `L ${ei.x} ${ei.y}`,\r\n `A ${innerR} ${innerR} 0 ${large} 1 ${si.x} ${si.y}`,\r\n \"Z\",\r\n ].join(\" \");\r\n};\r\n\r\n/** Compute smooth bezier control points (Catmull-Rom → cubic bezier). */\r\nexport const smoothPath = (\r\n points: { x: number; y: number }[],\r\n tension = 0.4\r\n): string => {\r\n if (points.length < 2) {\r\n return \"\";\r\n }\r\n if (points.length === 2) {\r\n return `M ${points[0].x} ${points[0].y} L ${points[1].x} ${points[1].y}`;\r\n }\r\n const parts: string[] = [`M ${points[0].x} ${points[0].y}`];\r\n for (let i = 0; i < points.length - 1; i += 1) {\r\n const p0 = points[Math.max(i - 1, 0)];\r\n const p1 = points[i];\r\n const p2 = points[i + 1];\r\n const p3 = points[Math.min(i + 2, points.length - 1)];\r\n const cp1x = p1.x + (p2.x - p0.x) * tension;\r\n const cp1y = p1.y + (p2.y - p0.y) * tension;\r\n const cp2x = p2.x - (p3.x - p1.x) * tension;\r\n const cp2y = p2.y - (p3.y - p1.y) * tension;\r\n parts.push(`C ${cp1x} ${cp1y} ${cp2x} ${cp2y} ${p2.x} ${p2.y}`);\r\n }\r\n return parts.join(\" \");\r\n};\r\n\r\n/** Get the default chart color palette from the theme. */\r\nexport const getDefaultPalette = (t: PdfcnTheme): string[] => [\r\n t.colors.primary,\r\n t.colors.info ?? \"#3B82F6\",\r\n t.colors.success ?? \"#22C55E\",\r\n t.colors.warning ?? \"#F59E0B\",\r\n t.colors.destructive ?? \"#EF4444\",\r\n \"#8B5CF6\",\r\n \"#F97316\",\r\n \"#14B8A6\",\r\n];\r\n\r\n/** Derive ChartLayout from series data, SVG dimensions, and variant. */\r\nexport const buildLayout = (\r\n series: GraphSeries[],\r\n width: number,\r\n height: number,\r\n isPieOrDonut: boolean,\r\n yTickCount: number\r\n): ChartLayout => {\r\n const mL = isPieOrDonut ? CHART_MARGINS.pieLeft : CHART_MARGINS.axisLeft;\r\n const mB = isPieOrDonut ? CHART_MARGINS.pieBottom : CHART_MARGINS.axisBottom;\r\n const chartX = mL;\r\n const chartY = CHART_MARGINS.top;\r\n const chartW = width - mL - CHART_MARGINS.right;\r\n const chartH = height - CHART_MARGINS.top - mB;\r\n const allValues = series.flatMap((s) => s.data.map((d) => d.value));\r\n const rawMin = Math.min(...allValues, 0);\r\n const rawMax = Math.max(...allValues, 1);\r\n const yMin = Math.min(0, rawMin);\r\n const yMax = rawMax + (rawMax - yMin) * 0.08;\r\n return {\r\n chartH,\r\n chartW,\r\n chartX,\r\n chartY,\r\n svgH: height,\r\n svgW: width,\r\n xLabels: series[0]?.data.map((d) => d.label) ?? [],\r\n yMax,\r\n yMin,\r\n yTicks: computeYTicks(yMin, yMax, yTickCount),\r\n };\r\n};\r\n",
+ "content": "import type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type {\n ChartLayout,\n GraphDataPoint,\n GraphSeries,\n GraphWidthOptions,\n} from \"./graph.types\";\n\n/** Standard A4 page width in PDF points. */\nexport const A4_WIDTH = 595;\n\n/**\n * Pre-calculated safe graph widths for common scenarios.\n * These values work with all built-in themes on A4 pages.\n */\nexport const GRAPH_SAFE_WIDTHS = {\n /** Safe width for graph directly in page content (no extra containers) */\n default: 420,\n /** Safe width for graph inside a Section with md padding */\n inSection: 400,\n /** Safe width for graph inside a Section + bordered wrapper (like graphShell) */\n inSectionWithWrapper: 380,\n} as const;\n\n/**\n * Calculate the safe graph width based on theme page margins and container context.\n *\n * This utility ensures graphs don't overflow their container by accounting for:\n * - Page margins (from theme)\n * - Container padding (e.g., Section component)\n * - Wrapper padding (e.g., a bordered graphShell View)\n *\n * @example\n * ```tsx\n * const width = getGraphWidth(theme);\n * // For a graph inside a Section with padding=\"md\" (12pt) and a graphShell (12pt):\n * const width = getGraphWidth(theme, { containerPadding: 12, wrapperPadding: 12 });\n * ```\n */\nexport const getGraphWidth = (\n theme: PdfcnTheme,\n options: GraphWidthOptions = {}\n): number => {\n const {\n containerPadding = 0,\n wrapperPadding = 0,\n pageWidth = A4_WIDTH,\n } = options;\n const { marginLeft, marginRight } = theme.spacing.page;\n const availableWidth =\n pageWidth -\n marginLeft -\n marginRight -\n containerPadding * 2 -\n wrapperPadding * 2;\n return Math.max(Math.floor(availableWidth), 100);\n};\n\nexport const CHART_MARGINS = {\n axisBottom: 24,\n axisLeft: 40,\n pieBottom: 10,\n pieLeft: 10,\n right: 10,\n top: 10,\n} as const;\n\n/** Normalize to always work with GraphSeries[]. */\nexport const normalizeData = (\n data: GraphDataPoint[] | GraphSeries[]\n): GraphSeries[] => {\n if (data.length === 0) {\n return [];\n }\n if (\"label\" in data[0] && \"value\" in data[0]) {\n return [{ data: data as GraphDataPoint[], name: \"Series 1\" }];\n }\n return data as GraphSeries[];\n};\n\n/** Compute nice Y-axis ticks for a given value range. */\nexport const computeYTicks = (\n min: number,\n max: number,\n count: number\n): number[] => {\n if (min === max) {\n return [0, max || 1];\n }\n const step = (max - min) / (count - 1);\n return Array.from({ length: count }, (_, i) => {\n const v = min + i * step;\n return Math.round(v * 100) / 100;\n });\n};\n\n/** Format a number for display on axis labels. */\nexport const fmtNum = (v: number): string => {\n if (Math.abs(v) >= 1_000_000) {\n return `${(v / 1_000_000).toFixed(1)}M`;\n }\n if (Math.abs(v) >= 1000) {\n return `${(v / 1000).toFixed(1)}K`;\n }\n if (!Number.isInteger(v)) {\n return v.toFixed(1);\n }\n return String(v);\n};\n\n/** Truncate a label to at most maxLen characters. */\nexport const truncate = (s: string, maxLen: number): string =>\n s.length > maxLen ? `${s.slice(0, maxLen - 1)}…` : s;\n\n/** Polar to Cartesian coordinate conversion for pie/donut arcs. */\nexport const polarToCartesian = (\n cx: number,\n cy: number,\n r: number,\n angleDeg: number\n) => {\n const rad = ((angleDeg - 90) * Math.PI) / 180;\n return { x: cx + r * Math.cos(rad), y: cy + r * Math.sin(rad) };\n};\n\n/** Build an SVG arc path for a pie/donut slice. */\nexport const arcPath = (\n cx: number,\n cy: number,\n r: number,\n startAngle: number,\n endAngle: number,\n innerR = 0\n): string => {\n const safeEnd = Math.min(endAngle, startAngle + 359.999);\n const large = safeEnd - startAngle > 180 ? 1 : 0;\n const s = polarToCartesian(cx, cy, r, safeEnd);\n const e = polarToCartesian(cx, cy, r, startAngle);\n if (innerR === 0) {\n return `M ${cx} ${cy} L ${s.x} ${s.y} A ${r} ${r} 0 ${large} 0 ${e.x} ${e.y} Z`;\n }\n const si = polarToCartesian(cx, cy, innerR, safeEnd);\n const ei = polarToCartesian(cx, cy, innerR, startAngle);\n return [\n `M ${s.x} ${s.y}`,\n `A ${r} ${r} 0 ${large} 0 ${e.x} ${e.y}`,\n `L ${ei.x} ${ei.y}`,\n `A ${innerR} ${innerR} 0 ${large} 1 ${si.x} ${si.y}`,\n \"Z\",\n ].join(\" \");\n};\n\n/** Compute smooth bezier control points (Catmull-Rom → cubic bezier). */\nexport const smoothPath = (\n points: { x: number; y: number }[],\n tension = 0.4\n): string => {\n if (points.length < 2) {\n return \"\";\n }\n if (points.length === 2) {\n return `M ${points[0].x} ${points[0].y} L ${points[1].x} ${points[1].y}`;\n }\n const parts: string[] = [`M ${points[0].x} ${points[0].y}`];\n for (let i = 0; i < points.length - 1; i += 1) {\n const p0 = points[Math.max(i - 1, 0)];\n const p1 = points[i];\n const p2 = points[i + 1];\n const p3 = points[Math.min(i + 2, points.length - 1)];\n const cp1x = p1.x + (p2.x - p0.x) * tension;\n const cp1y = p1.y + (p2.y - p0.y) * tension;\n const cp2x = p2.x - (p3.x - p1.x) * tension;\n const cp2y = p2.y - (p3.y - p1.y) * tension;\n parts.push(`C ${cp1x} ${cp1y} ${cp2x} ${cp2y} ${p2.x} ${p2.y}`);\n }\n return parts.join(\" \");\n};\n\n/** Get the default chart color palette from the theme. */\nexport const getDefaultPalette = (t: PdfcnTheme): string[] => [\n t.colors.primary,\n t.colors.info ?? \"#3B82F6\",\n t.colors.success ?? \"#22C55E\",\n t.colors.warning ?? \"#F59E0B\",\n t.colors.destructive ?? \"#EF4444\",\n \"#8B5CF6\",\n \"#F97316\",\n \"#14B8A6\",\n];\n\n/** Derive ChartLayout from series data, SVG dimensions, and variant. */\nexport const buildLayout = (\n series: GraphSeries[],\n width: number,\n height: number,\n isPieOrDonut: boolean,\n yTickCount: number\n): ChartLayout => {\n const mL = isPieOrDonut ? CHART_MARGINS.pieLeft : CHART_MARGINS.axisLeft;\n const mB = isPieOrDonut ? CHART_MARGINS.pieBottom : CHART_MARGINS.axisBottom;\n const chartX = mL;\n const chartY = CHART_MARGINS.top;\n const chartW = width - mL - CHART_MARGINS.right;\n const chartH = height - CHART_MARGINS.top - mB;\n const allValues = series.flatMap((s) => s.data.map((d) => d.value));\n const rawMin = Math.min(...allValues, 0);\n const rawMax = Math.max(...allValues, 1);\n const yMin = Math.min(0, rawMin);\n const yMax = rawMax + (rawMax - yMin) * 0.08;\n return {\n chartH,\n chartW,\n chartX,\n chartY,\n svgH: height,\n svgW: width,\n xLabels: series[0]?.data.map((d) => d.label) ?? [],\n yMax,\n yMin,\n yTicks: computeYTicks(yMin, yMax, yTickCount),\n };\n};\n",
"type": "registry:component",
"target": "components/pdf/graph/graph.utils.ts"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/heading.json b/apps/web/public/r/forme/heading.json
index c5aac94..195c23d 100644
--- a/apps/web/public/r/forme/heading.json
+++ b/apps/web/public/r/forme/heading.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/forme/components/heading/heading.tsx",
- "content": "import {\r\n mergePdfStyles,\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport { StyleSheet, Text } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type HeadingWeight = \"normal\" | \"medium\" | \"semibold\" | \"bold\";\r\nexport type HeadingTracking = \"tighter\" | \"tight\" | \"normal\" | \"wide\" | \"wider\";\r\n\r\n/**\r\n * PDF heading mapped to h1–h6 font sizes from the theme.\r\n * Props - `level` | `align` | `color` | `transform` | `weight` | `tracking` | `noMargin` | `keepWithNext` | `children` | `style`\r\n * @see {@link HeadingProps}\r\n */\r\nexport interface HeadingProps extends PDFComponentProps {\r\n /**\r\n * @default 1\r\n */\r\n level?: 1 | 2 | 3 | 4 | 5 | 6;\r\n /**\r\n * @default 'left'\r\n */\r\n align?: \"left\" | \"center\" | \"right\";\r\n color?: string;\r\n transform?: \"uppercase\" | \"lowercase\" | \"capitalize\";\r\n /**\r\n * @default 'bold'\r\n */\r\n weight?: HeadingWeight;\r\n /**\r\n * @default 'normal'\r\n */\r\n tracking?: HeadingTracking;\r\n /**\r\n * @default false\r\n */\r\n noMargin?: boolean;\r\n keepWithNext?: boolean;\r\n}\r\n\r\nconst createHeadingStyles = (t: PdfcnTheme) => {\r\n const { heading } = t.typography;\r\n const { spacing, fontWeights, letterSpacing } = t.primitives;\r\n const { sectionGap, componentGap, paragraphGap } = t.spacing;\r\n const base = {\r\n color: t.colors.foreground,\r\n fontFamily: heading.fontFamily,\r\n fontWeight: fontWeights.bold,\r\n lineHeight: heading.lineHeight,\r\n };\r\n return StyleSheet.create({\r\n capitalize: { textTransform: \"capitalize\" },\r\n h1: {\r\n ...base,\r\n fontSize: heading.fontSize.h1,\r\n marginBottom: paragraphGap,\r\n marginTop: spacing[0],\r\n },\r\n h2: {\r\n ...base,\r\n fontSize: heading.fontSize.h2,\r\n marginBottom: paragraphGap,\r\n marginTop: sectionGap,\r\n },\r\n h3: {\r\n ...base,\r\n fontSize: heading.fontSize.h3,\r\n marginBottom: paragraphGap,\r\n marginTop: componentGap,\r\n },\r\n h4: {\r\n ...base,\r\n fontSize: heading.fontSize.h4,\r\n marginBottom: paragraphGap,\r\n marginTop: paragraphGap,\r\n },\r\n h5: {\r\n ...base,\r\n fontSize: heading.fontSize.h5,\r\n marginBottom: spacing[1],\r\n marginTop: paragraphGap,\r\n },\r\n h6: {\r\n ...base,\r\n fontSize: heading.fontSize.h6,\r\n marginBottom: spacing[1],\r\n marginTop: paragraphGap,\r\n },\r\n lowercase: { textTransform: \"lowercase\" },\r\n noMargin: { marginBottom: 0, marginTop: 0 },\r\n trackingNormal: { letterSpacing: letterSpacing.normal },\r\n trackingTight: { letterSpacing: letterSpacing.tight * 10 },\r\n trackingTighter: { letterSpacing: letterSpacing.tight * 15 },\r\n trackingWide: { letterSpacing: letterSpacing.wide * 10 },\r\n trackingWider: { letterSpacing: letterSpacing.wider * 10 },\r\n uppercase: {\r\n letterSpacing: letterSpacing.wider * 10,\r\n textTransform: \"uppercase\",\r\n },\r\n weightBold: { fontWeight: fontWeights.bold },\r\n weightMedium: { fontWeight: fontWeights.medium },\r\n weightNormal: { fontWeight: fontWeights.regular },\r\n weightSemibold: { fontWeight: fontWeights.semibold },\r\n });\r\n};\r\n\r\nexport const Heading = ({\r\n level = 1,\r\n align,\r\n color,\r\n transform,\r\n weight,\r\n tracking,\r\n noMargin,\r\n children,\r\n style,\r\n}: HeadingProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createHeadingStyles(theme), [theme]);\r\n const safeLevel = Math.min(Math.max(Math.round(level), 1), 6) as\r\n | 1\r\n | 2\r\n | 3\r\n | 4\r\n | 5\r\n | 6;\r\n const weightMap = {\r\n bold: styles.weightBold,\r\n medium: styles.weightMedium,\r\n normal: styles.weightNormal,\r\n semibold: styles.weightSemibold,\r\n };\r\n const trackingMap = {\r\n normal: styles.trackingNormal,\r\n tight: styles.trackingTight,\r\n tighter: styles.trackingTighter,\r\n wide: styles.trackingWide,\r\n wider: styles.trackingWider,\r\n };\r\n const transformMap = {\r\n capitalize: styles.capitalize,\r\n lowercase: styles.lowercase,\r\n uppercase: styles.uppercase,\r\n };\r\n const styleArray: Style[] = [\r\n styles[`h${safeLevel}` as keyof typeof styles] as Style,\r\n ];\r\n if (weight && weight in weightMap) {\r\n styleArray.push(weightMap[weight]);\r\n }\r\n if (tracking && tracking in trackingMap) {\r\n styleArray.push(trackingMap[tracking]);\r\n }\r\n if (transform && transform in transformMap) {\r\n styleArray.push(transformMap[transform as keyof typeof transformMap]);\r\n }\r\n if (noMargin) {\r\n styleArray.push(styles.noMargin);\r\n }\r\n const semantic = {} as Style;\r\n if (align) {\r\n semantic.textAlign = align;\r\n }\r\n if (color) {\r\n semantic.color = resolveColor(color, theme.colors);\r\n }\r\n if (Object.keys(semantic).length > 0) {\r\n styleArray.push(semantic);\r\n }\r\n if (style) {\r\n styleArray.push(...[style].flat());\r\n }\r\n return <Text style={mergePdfStyles(styleArray)}>{children}</Text>;\r\n};\r\n",
+ "content": "import {\n mergePdfStyles,\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport { StyleSheet, Text } from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type HeadingWeight = \"normal\" | \"medium\" | \"semibold\" | \"bold\";\nexport type HeadingTracking = \"tighter\" | \"tight\" | \"normal\" | \"wide\" | \"wider\";\n\n/**\n * PDF heading mapped to h1–h6 font sizes from the theme.\n * Props - `level` | `align` | `color` | `transform` | `weight` | `tracking` | `noMargin` | `keepWithNext` | `children` | `style`\n * @see {@link HeadingProps}\n */\nexport interface HeadingProps extends PDFComponentProps {\n /**\n * @default 1\n */\n level?: 1 | 2 | 3 | 4 | 5 | 6;\n /**\n * @default 'left'\n */\n align?: \"left\" | \"center\" | \"right\";\n color?: string;\n transform?: \"uppercase\" | \"lowercase\" | \"capitalize\";\n /**\n * @default 'bold'\n */\n weight?: HeadingWeight;\n /**\n * @default 'normal'\n */\n tracking?: HeadingTracking;\n /**\n * @default false\n */\n noMargin?: boolean;\n keepWithNext?: boolean;\n}\n\nconst createHeadingStyles = (t: PdfcnTheme) => {\n const { heading } = t.typography;\n const { spacing, fontWeights, letterSpacing } = t.primitives;\n const { sectionGap, componentGap, paragraphGap } = t.spacing;\n const base = {\n color: t.colors.foreground,\n fontFamily: heading.fontFamily,\n fontWeight: fontWeights.bold,\n lineHeight: heading.lineHeight,\n };\n return StyleSheet.create({\n capitalize: { textTransform: \"capitalize\" },\n h1: {\n ...base,\n fontSize: heading.fontSize.h1,\n marginBottom: paragraphGap,\n marginTop: spacing[0],\n },\n h2: {\n ...base,\n fontSize: heading.fontSize.h2,\n marginBottom: paragraphGap,\n marginTop: sectionGap,\n },\n h3: {\n ...base,\n fontSize: heading.fontSize.h3,\n marginBottom: paragraphGap,\n marginTop: componentGap,\n },\n h4: {\n ...base,\n fontSize: heading.fontSize.h4,\n marginBottom: paragraphGap,\n marginTop: paragraphGap,\n },\n h5: {\n ...base,\n fontSize: heading.fontSize.h5,\n marginBottom: spacing[1],\n marginTop: paragraphGap,\n },\n h6: {\n ...base,\n fontSize: heading.fontSize.h6,\n marginBottom: spacing[1],\n marginTop: paragraphGap,\n },\n lowercase: { textTransform: \"lowercase\" },\n noMargin: { marginBottom: 0, marginTop: 0 },\n trackingNormal: { letterSpacing: letterSpacing.normal },\n trackingTight: { letterSpacing: letterSpacing.tight * 10 },\n trackingTighter: { letterSpacing: letterSpacing.tight * 15 },\n trackingWide: { letterSpacing: letterSpacing.wide * 10 },\n trackingWider: { letterSpacing: letterSpacing.wider * 10 },\n uppercase: {\n letterSpacing: letterSpacing.wider * 10,\n textTransform: \"uppercase\",\n },\n weightBold: { fontWeight: fontWeights.bold },\n weightMedium: { fontWeight: fontWeights.medium },\n weightNormal: { fontWeight: fontWeights.regular },\n weightSemibold: { fontWeight: fontWeights.semibold },\n });\n};\n\nexport const Heading = ({\n level = 1,\n align,\n color,\n transform,\n weight,\n tracking,\n noMargin,\n children,\n style,\n}: HeadingProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createHeadingStyles(theme), [theme]);\n const safeLevel = Math.min(Math.max(Math.round(level), 1), 6) as\n | 1\n | 2\n | 3\n | 4\n | 5\n | 6;\n const weightMap = {\n bold: styles.weightBold,\n medium: styles.weightMedium,\n normal: styles.weightNormal,\n semibold: styles.weightSemibold,\n };\n const trackingMap = {\n normal: styles.trackingNormal,\n tight: styles.trackingTight,\n tighter: styles.trackingTighter,\n wide: styles.trackingWide,\n wider: styles.trackingWider,\n };\n const transformMap = {\n capitalize: styles.capitalize,\n lowercase: styles.lowercase,\n uppercase: styles.uppercase,\n };\n const styleArray: Style[] = [\n styles[`h${safeLevel}` as keyof typeof styles] as Style,\n ];\n if (weight && weight in weightMap) {\n styleArray.push(weightMap[weight]);\n }\n if (tracking && tracking in trackingMap) {\n styleArray.push(trackingMap[tracking]);\n }\n if (transform && transform in transformMap) {\n styleArray.push(transformMap[transform as keyof typeof transformMap]);\n }\n if (noMargin) {\n styleArray.push(styles.noMargin);\n }\n const semantic = {} as Style;\n if (align) {\n semantic.textAlign = align;\n }\n if (color) {\n semantic.color = resolveColor(color, theme.colors);\n }\n if (Object.keys(semantic).length > 0) {\n styleArray.push(semantic);\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return <Text style={mergePdfStyles(styleArray)}>{children}</Text>;\n};\n",
"type": "registry:component",
"target": "components/pdf/heading/heading.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/invoice-classic.json b/apps/web/public/r/forme/invoice-classic.json
index dd4cee0..7494fcc 100644
--- a/apps/web/public/r/forme/invoice-classic.json
+++ b/apps/web/public/r/forme/invoice-classic.json
@@ -20,16 +20,16 @@
"files": [
{
"path": "registry/bases/forme/blocks/invoice-classic/invoice-classic.tsx",
- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\r\n\r\nimport { KeyValue } from \"@/registry/bases/forme/components/key-value/key-value\";\r\nimport { PageFooter } from \"@/registry/bases/forme/components/page-footer/page-footer\";\r\nimport { PageHeader } from \"@/registry/bases/forme/components/page-header/page-header\";\r\nimport { PdfImage } from \"@/registry/bases/forme/components/pdf-image/pdf-image\";\r\nimport { Section } from \"@/registry/bases/forme/components/section/section\";\r\nimport {\r\n Table,\r\n TableBody,\r\n TableCell,\r\n TableHeader,\r\n TableRow,\r\n} from \"@/registry/bases/forme/components/table/table\";\r\nimport { Text } from \"@/registry/bases/forme/components/text/text\";\r\nimport {\r\n PdfcnThemeProvider,\r\n usePdfcnTheme,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { InvoiceClassicData } from \"./invoice-classic.types\";\r\n\r\n// Sample data — replace with your own props or data source\r\nconst sampleData: InvoiceClassicData = {\r\n billTo: {\r\n address: \"456 Client Ave, Suite 2\",\r\n email: \"[email protected]\",\r\n name: \"Client Corp.\",\r\n phone: \"+1 (555) 123-4567\",\r\n },\r\n companyAddress: \"Nagpur, IN\",\r\n companyEmail: \"[email protected]\",\r\n companyName: \"pdfcn\",\r\n dueDate: \"March 17, 2026\",\r\n invoiceDate: \"February 17, 2026\",\r\n invoiceNumber: \"INV-2026-001\",\r\n items: [\r\n { description: \"Web Development\", quantity: 1, unitPrice: 12_500 },\r\n { description: \"UI/UX Design\", quantity: 1, unitPrice: 8750 },\r\n { description: \"Consulting\", quantity: 10, unitPrice: 1500 },\r\n ],\r\n logo: \"/favicon.png\",\r\n notes: \"Thank you for your business!\",\r\n paymentTerms: {\r\n dueDate: \"March 17, 2026\",\r\n gst: \"GSTIN 123456789\",\r\n method: \"UPI / Card / Bank Transfer\",\r\n },\r\n subtitle: \"Innovative PDF Solutions\",\r\n summary: {\r\n subtotal: 36_250,\r\n tax: 2537.5,\r\n total: 38_787.5,\r\n },\r\n};\r\n\r\nconst InvoiceClassicContent = ({ data }: { data: InvoiceClassicData }) => {\r\n const theme = usePdfcnTheme();\r\n\r\n const styles = StyleSheet.create({\r\n page: {\r\n backgroundColor: theme.colors.background,\r\n },\r\n });\r\n\r\n return (\r\n <Document title={`Invoice ${data.invoiceNumber}`}>\r\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\r\n <PageFooter\r\n leftText={data.notes}\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={25}\r\n />\r\n <View style={styles.page as never}>\r\n <PageHeader\r\n variant=\"logo-left\"\r\n logo={\r\n <PdfImage\r\n src={data.logo ?? \"/favicon.png\"}\r\n style={{ margin: 0 }}\r\n />\r\n }\r\n title={data.companyName}\r\n subtitle={data.subtitle}\r\n rightText={data.invoiceNumber}\r\n rightSubText={`Due: ${data.dueDate}`}\r\n style={{ marginBottom: 0 }}\r\n />\r\n <Section noWrap style={{ flexDirection: \"row\" }}>\r\n <View style={{ flex: 1, paddingRight: 15 }}>\r\n <Text\r\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\r\n color=\"mutedForeground\"\r\n transform=\"uppercase\"\r\n noMargin\r\n >\r\n From\r\n </Text>\r\n <Text noMargin variant=\"xs\">\r\n {data.companyName}\r\n </Text>\r\n <Text noMargin variant=\"xs\">\r\n {data.companyAddress}\r\n </Text>\r\n <Text noMargin variant=\"xs\">\r\n {data.companyEmail}\r\n </Text>\r\n </View>\r\n <View style={{ flex: 1, paddingRight: 15 }}>\r\n <Text\r\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\r\n color=\"mutedForeground\"\r\n transform=\"uppercase\"\r\n noMargin\r\n >\r\n Bill To\r\n </Text>\r\n <Text noMargin variant=\"xs\">\r\n {data.billTo.name}\r\n </Text>\r\n <Text noMargin variant=\"xs\">\r\n {data.billTo.address}\r\n </Text>\r\n <Text noMargin variant=\"xs\">\r\n {data.billTo.email}\r\n </Text>\r\n </View>\r\n <View style={{ flex: 1, paddingRight: 15 }}>\r\n <Text\r\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\r\n color=\"mutedForeground\"\r\n transform=\"uppercase\"\r\n noMargin\r\n >\r\n Payment Terms\r\n </Text>\r\n <Text noMargin variant=\"xs\">\r\n {data.paymentTerms.method}\r\n </Text>\r\n <Text noMargin variant=\"xs\">\r\n {data.paymentTerms.gst}\r\n </Text>\r\n <Text noMargin variant=\"xs\">\r\n {data.paymentTerms.dueDate}\r\n </Text>\r\n </View>\r\n </Section>\r\n <Table variant=\"grid\" zebraStripe>\r\n <TableHeader>\r\n <TableRow header>\r\n <TableCell>Description</TableCell>\r\n <TableCell align=\"center\">QTY</TableCell>\r\n <TableCell align=\"center\">Rate</TableCell>\r\n <TableCell align=\"right\">Total</TableCell>\r\n </TableRow>\r\n </TableHeader>\r\n <TableBody>\r\n {data.items.map((item, index) => (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\r\n <TableRow key={index}>\r\n <TableCell>{item.description}</TableCell>\r\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\r\n <TableCell align=\"center\">{`$${item.unitPrice}`}</TableCell>\r\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\r\n </TableRow>\r\n ))}\r\n </TableBody>\r\n </Table>\r\n <Section\r\n noWrap\r\n style={{\r\n flexDirection: \"row\",\r\n justifyContent: \"flex-end\",\r\n marginTop: 16,\r\n }}\r\n >\r\n <View style={{ width: 220 }}>\r\n <KeyValue\r\n size=\"sm\"\r\n dividerThickness={1}\r\n items={[\r\n {\r\n key: \"Subtotal\",\r\n value: `$${data.summary.subtotal.toFixed(2)}`,\r\n },\r\n { key: \"Tax\", value: `$${data.summary.tax.toFixed(2)}` },\r\n {\r\n key: \"Total\",\r\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\r\n value: `$${data.summary.total.toFixed(2)}`,\r\n valueStyle: { fontSize: 12, fontWeight: \"bold\" },\r\n },\r\n ]}\r\n divided\r\n />\r\n </View>\r\n </Section>\r\n </View>\r\n </Page>\r\n </Document>\r\n );\r\n};\r\n\r\nexport const InvoiceClassicDocument = ({\r\n theme,\r\n data = sampleData,\r\n}: {\r\n theme?: PdfcnTheme;\r\n data?: InvoiceClassicData;\r\n}) => (\r\n <PdfcnThemeProvider theme={theme}>\r\n <InvoiceClassicContent data={data} />\r\n </PdfcnThemeProvider>\r\n);\r\n",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { PdfImage } from \"@/components/pdf/pdf-image/pdf-image\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { InvoiceClassicData } from \"./invoice-classic.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: InvoiceClassicData = {\n billTo: {\n address: \"456 Client Ave, Suite 2\",\n email: \"[email protected]\",\n name: \"Client Corp.\",\n phone: \"+1 (555) 123-4567\",\n },\n companyAddress: \"Nagpur, IN\",\n companyEmail: \"[email protected]\",\n companyName: \"pdfcn\",\n dueDate: \"March 17, 2026\",\n invoiceDate: \"February 17, 2026\",\n invoiceNumber: \"INV-2026-001\",\n items: [\n { description: \"Web Development\", quantity: 1, unitPrice: 12_500 },\n { description: \"UI/UX Design\", quantity: 1, unitPrice: 8750 },\n { description: \"Consulting\", quantity: 10, unitPrice: 1500 },\n ],\n logo: \"/favicon.png\",\n notes: \"Thank you for your business!\",\n paymentTerms: {\n dueDate: \"March 17, 2026\",\n gst: \"GSTIN 123456789\",\n method: \"UPI / Card / Bank Transfer\",\n },\n subtitle: \"Innovative PDF Solutions\",\n summary: {\n subtotal: 36_250,\n tax: 2537.5,\n total: 38_787.5,\n },\n};\n\nconst InvoiceClassicContent = ({ data }: { data: InvoiceClassicData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n page: {\n backgroundColor: theme.colors.background,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"logo-left\"\n logo={\n <PdfImage\n src={data.logo ?? \"/favicon.png\"}\n style={{ margin: 0 }}\n />\n }\n title={data.companyName}\n subtitle={data.subtitle}\n rightText={data.invoiceNumber}\n rightSubText={`Due: ${data.dueDate}`}\n style={{ marginBottom: 0 }}\n />\n <Section noWrap style={{ flexDirection: \"row\" }}>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n From\n </Text>\n <Text noMargin variant=\"xs\">\n {data.companyName}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.companyAddress}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.companyEmail}\n </Text>\n </View>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Bill To\n </Text>\n <Text noMargin variant=\"xs\">\n {data.billTo.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.billTo.address}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.billTo.email}\n </Text>\n </View>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Payment Terms\n </Text>\n <Text noMargin variant=\"xs\">\n {data.paymentTerms.method}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.paymentTerms.gst}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.paymentTerms.dueDate}\n </Text>\n </View>\n </Section>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">QTY</TableCell>\n <TableCell align=\"center\">Rate</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"center\">{`$${item.unitPrice}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section\n noWrap\n style={{\n flexDirection: \"row\",\n justifyContent: \"flex-end\",\n marginTop: 16,\n }}\n >\n <View style={{ width: 220 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toFixed(2)}`,\n },\n { key: \"Tax\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Total\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: { fontSize: 12, fontWeight: \"bold\" },\n },\n ]}\n divided\n />\n </View>\n </Section>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceClassicDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceClassicData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceClassicContent data={data} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-classic/invoice-classic.tsx"
},
{
"path": "registry/bases/forme/blocks/invoice-classic/invoice-classic.types.ts",
- "content": "export interface InvoiceClassicData {\r\n invoiceNumber: string;\r\n invoiceDate: string;\r\n dueDate: string;\r\n companyName: string;\r\n subtitle: string;\r\n companyAddress: string;\r\n companyEmail: string;\r\n logo?: string;\r\n billTo: {\r\n name: string;\r\n address: string;\r\n email: string;\r\n phone: string;\r\n };\r\n items: {\r\n description: string;\r\n quantity: number;\r\n unitPrice: number;\r\n }[];\r\n summary: {\r\n subtotal: number;\r\n tax: number;\r\n total: number;\r\n };\r\n paymentTerms: {\r\n dueDate: string;\r\n method: string;\r\n gst: string;\r\n };\r\n notes?: string;\r\n}\r\n",
+ "content": "export interface InvoiceClassicData {\n invoiceNumber: string;\n invoiceDate: string;\n dueDate: string;\n companyName: string;\n subtitle: string;\n companyAddress: string;\n companyEmail: string;\n logo?: string;\n billTo: {\n name: string;\n address: string;\n email: string;\n phone: string;\n };\n items: {\n description: string;\n quantity: number;\n unitPrice: number;\n }[];\n summary: {\n subtotal: number;\n tax: number;\n total: number;\n };\n paymentTerms: {\n dueDate: string;\n method: string;\n gst: string;\n };\n notes?: string;\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-classic/invoice-classic.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/invoice-consultant.json b/apps/web/public/r/forme/invoice-consultant.json
index e4ba56f..a097086 100644
--- a/apps/web/public/r/forme/invoice-consultant.json
+++ b/apps/web/public/r/forme/invoice-consultant.json
@@ -18,16 +18,16 @@
"files": [
{
"path": "registry/bases/forme/blocks/invoice-consultant/invoice-consultant.tsx",
- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\r\n\r\nimport { KeyValue } from \"@/registry/bases/forme/components/key-value/key-value\";\r\nimport { PageFooter } from \"@/registry/bases/forme/components/page-footer/page-footer\";\r\nimport { Section } from \"@/registry/bases/forme/components/section/section\";\r\nimport {\r\n Table,\r\n TableBody,\r\n TableCell,\r\n TableHeader,\r\n TableRow,\r\n} from \"@/registry/bases/forme/components/table/table\";\r\nimport { Text } from \"@/registry/bases/forme/components/text/text\";\r\nimport {\r\n PdfcnThemeProvider,\r\n usePdfcnTheme,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { InvoiceConsultantData } from \"./invoice-consultant.types\";\r\n\r\nconst sampleData: InvoiceConsultantData = {\r\n client: {\r\n address: \"500 Tech Park, Suite 200\",\r\n company: \"Acme Technologies\",\r\n email: \"[email protected]\",\r\n name: \"Sarah Johnson\",\r\n },\r\n companyAddress: \"Nagpur, IN · [email protected]\",\r\n companyName: \"pdfcn\",\r\n consultant: {\r\n email: \"[email protected]\",\r\n name: \"John Smith\",\r\n title: \"Senior Technical Consultant\",\r\n },\r\n dueDate: \"March 28, 2026\",\r\n invoiceDate: \"February 26, 2026\",\r\n invoiceNumber: \"INV-2026-006\",\r\n notes:\r\n \"Services rendered for February 2026. All hours verified and approved by client.\",\r\n paymentTerms: {\r\n dueDate: \"March 28, 2026\",\r\n method: \"Bank Transfer / Check\",\r\n },\r\n projectRef: \"PROJ-2026-ACME-001\",\r\n services: [\r\n { description: \"Architecture Review & Planning\", hours: 16, rate: 175 },\r\n { description: \"Code Review & Optimization\", hours: 24, rate: 150 },\r\n { description: \"Technical Documentation\", hours: 12, rate: 125 },\r\n { description: \"Team Training & Knowledge Transfer\", hours: 8, rate: 200 },\r\n ],\r\n subtitle: \"Professional Consulting Services\",\r\n summary: {\r\n subtotal: 9500,\r\n tax: 475,\r\n total: 9975,\r\n totalHours: 60,\r\n },\r\n};\r\n\r\nconst InvoiceConsultantContent = ({\r\n data,\r\n}: {\r\n data: InvoiceConsultantData;\r\n}) => {\r\n const theme = usePdfcnTheme();\r\n\r\n const styles = StyleSheet.create({\r\n calloutNote: {\r\n backgroundColor: theme.colors.muted,\r\n borderLeftColor: theme.colors.info,\r\n borderLeftStyle: \"solid\",\r\n borderLeftWidth: 3,\r\n marginTop: 16,\r\n paddingLeft: 12,\r\n paddingVertical: 8,\r\n },\r\n companyInfo: {\r\n flex: 1,\r\n },\r\n headerRow: {\r\n alignItems: \"flex-start\",\r\n borderBottomColor: theme.colors.primary,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: 2,\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n marginBottom: theme.spacing.sectionGap,\r\n paddingBottom: theme.spacing.componentGap,\r\n },\r\n hoursBadge: {\r\n alignSelf: \"flex-start\",\r\n backgroundColor: theme.colors.primary,\r\n borderRadius: theme.primitives.borderRadius.sm,\r\n color: theme.colors.primaryForeground,\r\n paddingHorizontal: 12,\r\n paddingVertical: 8,\r\n },\r\n hoursBox: {\r\n flex: 1,\r\n paddingRight: 24,\r\n },\r\n invoiceInfo: {\r\n alignItems: \"flex-end\",\r\n },\r\n page: {\r\n backgroundColor: theme.colors.background,\r\n },\r\n partiesRow: {\r\n flexDirection: \"row\",\r\n gap: 40,\r\n marginBottom: theme.spacing.sectionGap,\r\n },\r\n partyColumn: {\r\n flex: 1,\r\n },\r\n partyLabel: {\r\n borderBottomColor: theme.colors.border,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: 1,\r\n color: theme.colors.primary,\r\n fontSize: 9,\r\n fontWeight: \"bold\",\r\n letterSpacing: 0.6,\r\n marginBottom: 6,\r\n paddingBottom: 4,\r\n textTransform: \"uppercase\",\r\n },\r\n projectRef: {\r\n alignItems: \"center\",\r\n backgroundColor: theme.colors.muted,\r\n borderRadius: theme.primitives.borderRadius.sm,\r\n flexDirection: \"row\",\r\n gap: 8,\r\n marginBottom: theme.spacing.sectionGap,\r\n paddingHorizontal: 10,\r\n paddingVertical: 6,\r\n },\r\n summaryRow: {\r\n flexDirection: \"row\",\r\n marginTop: 20,\r\n },\r\n totalsBox: {\r\n width: 250,\r\n },\r\n });\r\n\r\n return (\r\n <Document title={`Invoice ${data.invoiceNumber}`}>\r\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\r\n <PageFooter\r\n leftText=\"Professional services invoice – Please retain for records\"\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={25}\r\n />\r\n <View style={styles.page as never}>\r\n <View style={styles.headerRow}>\r\n <View style={styles.companyInfo}>\r\n <Text variant=\"xl\" weight=\"bold\" noMargin>\r\n {data.companyName}\r\n </Text>\r\n <Text variant=\"sm\" color=\"mutedForeground\" noMargin>\r\n {data.subtitle}\r\n </Text>\r\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\r\n {data.companyAddress}\r\n </Text>\r\n </View>\r\n <View style={styles.invoiceInfo}>\r\n <Text\r\n variant=\"xs\"\r\n color=\"mutedForeground\"\r\n transform=\"uppercase\"\r\n noMargin\r\n >\r\n Invoice\r\n </Text>\r\n <Text variant=\"lg\" weight=\"bold\" noMargin>\r\n {data.invoiceNumber}\r\n </Text>\r\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\r\n {data.invoiceDate}\r\n </Text>\r\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\r\n Due: {data.dueDate}\r\n </Text>\r\n </View>\r\n </View>\r\n {data.projectRef && (\r\n <View style={styles.projectRef}>\r\n <Text\r\n variant=\"xs\"\r\n weight=\"semibold\"\r\n color=\"mutedForeground\"\r\n noMargin\r\n >\r\n Project Reference:\r\n </Text>\r\n <Text variant=\"xs\" weight=\"bold\" noMargin>\r\n {data.projectRef}\r\n </Text>\r\n </View>\r\n )}\r\n <View style={styles.partiesRow}>\r\n <View style={styles.partyColumn}>\r\n <Text style={styles.partyLabel} noMargin>\r\n From (Consultant)\r\n </Text>\r\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\r\n {data.consultant.name}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.consultant.title}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.consultant.email}\r\n </Text>\r\n </View>\r\n <View style={styles.partyColumn}>\r\n <Text style={styles.partyLabel} noMargin>\r\n Bill To (Client)\r\n </Text>\r\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\r\n {data.client.name}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.client.company}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.client.address}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.client.email}\r\n </Text>\r\n </View>\r\n </View>\r\n <Table variant=\"line\">\r\n <TableHeader>\r\n <TableRow header>\r\n <TableCell>Service Description</TableCell>\r\n <TableCell align=\"center\">Hours</TableCell>\r\n <TableCell align=\"right\">Rate ($/hr)</TableCell>\r\n <TableCell align=\"right\">Amount</TableCell>\r\n </TableRow>\r\n </TableHeader>\r\n <TableBody>\r\n {data.services.map((service, index) => (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\r\n <TableRow key={index}>\r\n <TableCell>{service.description}</TableCell>\r\n <TableCell align=\"center\">{`${service.hours}`}</TableCell>\r\n <TableCell align=\"right\">{`$${service.rate}`}</TableCell>\r\n <TableCell align=\"right\">{`$${(service.hours * service.rate).toLocaleString()}`}</TableCell>\r\n </TableRow>\r\n ))}\r\n </TableBody>\r\n </Table>\r\n <Section noWrap style={styles.summaryRow}>\r\n <View style={styles.hoursBox}>\r\n <View style={styles.hoursBadge}>\r\n <Text\r\n style={{\r\n color: theme.colors.primaryForeground,\r\n fontSize: 9,\r\n fontWeight: \"bold\",\r\n }}\r\n noMargin\r\n >\r\n Total Hours: {data.summary.totalHours}\r\n </Text>\r\n </View>\r\n <Text\r\n variant=\"xs\"\r\n color=\"mutedForeground\"\r\n style={{ marginTop: 8 }}\r\n >\r\n Payment: {data.paymentTerms.method}\r\n </Text>\r\n </View>\r\n <View style={styles.totalsBox}>\r\n <KeyValue\r\n size=\"sm\"\r\n dividerThickness={1}\r\n items={[\r\n {\r\n key: \"Subtotal\",\r\n value: `$${data.summary.subtotal.toLocaleString()}`,\r\n },\r\n { key: \"Tax (5%)\", value: `$${data.summary.tax.toFixed(2)}` },\r\n {\r\n key: \"Amount Due\",\r\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\r\n value: `$${data.summary.total.toFixed(2)}`,\r\n valueStyle: {\r\n color: theme.colors.primary,\r\n fontSize: 14,\r\n fontWeight: \"bold\",\r\n },\r\n },\r\n ]}\r\n divided\r\n />\r\n </View>\r\n </Section>\r\n {data.notes && (\r\n <View style={styles.calloutNote}>\r\n <Text variant=\"xs\" color=\"mutedForeground\">\r\n {data.notes}\r\n </Text>\r\n </View>\r\n )}\r\n </View>\r\n </Page>\r\n </Document>\r\n );\r\n};\r\n\r\nexport const InvoiceConsultantDocument = ({\r\n theme,\r\n data = sampleData,\r\n}: {\r\n theme?: PdfcnTheme;\r\n data?: InvoiceConsultantData;\r\n}) => (\r\n <PdfcnThemeProvider theme={theme}>\r\n <InvoiceConsultantContent data={data} />\r\n </PdfcnThemeProvider>\r\n);\r\n",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { InvoiceConsultantData } from \"./invoice-consultant.types\";\n\nconst sampleData: InvoiceConsultantData = {\n client: {\n address: \"500 Tech Park, Suite 200\",\n company: \"Acme Technologies\",\n email: \"[email protected]\",\n name: \"Sarah Johnson\",\n },\n companyAddress: \"Nagpur, IN · [email protected]\",\n companyName: \"pdfcn\",\n consultant: {\n email: \"[email protected]\",\n name: \"John Smith\",\n title: \"Senior Technical Consultant\",\n },\n dueDate: \"March 28, 2026\",\n invoiceDate: \"February 26, 2026\",\n invoiceNumber: \"INV-2026-006\",\n notes:\n \"Services rendered for February 2026. All hours verified and approved by client.\",\n paymentTerms: {\n dueDate: \"March 28, 2026\",\n method: \"Bank Transfer / Check\",\n },\n projectRef: \"PROJ-2026-ACME-001\",\n services: [\n { description: \"Architecture Review & Planning\", hours: 16, rate: 175 },\n { description: \"Code Review & Optimization\", hours: 24, rate: 150 },\n { description: \"Technical Documentation\", hours: 12, rate: 125 },\n { description: \"Team Training & Knowledge Transfer\", hours: 8, rate: 200 },\n ],\n subtitle: \"Professional Consulting Services\",\n summary: {\n subtotal: 9500,\n tax: 475,\n total: 9975,\n totalHours: 60,\n },\n};\n\nconst InvoiceConsultantContent = ({\n data,\n}: {\n data: InvoiceConsultantData;\n}) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n calloutNote: {\n backgroundColor: theme.colors.muted,\n borderLeftColor: theme.colors.info,\n borderLeftStyle: \"solid\",\n borderLeftWidth: 3,\n marginTop: 16,\n paddingLeft: 12,\n paddingVertical: 8,\n },\n companyInfo: {\n flex: 1,\n },\n headerRow: {\n alignItems: \"flex-start\",\n borderBottomColor: theme.colors.primary,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 2,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: theme.spacing.sectionGap,\n paddingBottom: theme.spacing.componentGap,\n },\n hoursBadge: {\n alignSelf: \"flex-start\",\n backgroundColor: theme.colors.primary,\n borderRadius: theme.primitives.borderRadius.sm,\n color: theme.colors.primaryForeground,\n paddingHorizontal: 12,\n paddingVertical: 8,\n },\n hoursBox: {\n flex: 1,\n paddingRight: 24,\n },\n invoiceInfo: {\n alignItems: \"flex-end\",\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n partiesRow: {\n flexDirection: \"row\",\n gap: 40,\n marginBottom: theme.spacing.sectionGap,\n },\n partyColumn: {\n flex: 1,\n },\n partyLabel: {\n borderBottomColor: theme.colors.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n color: theme.colors.primary,\n fontSize: 9,\n fontWeight: \"bold\",\n letterSpacing: 0.6,\n marginBottom: 6,\n paddingBottom: 4,\n textTransform: \"uppercase\",\n },\n projectRef: {\n alignItems: \"center\",\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.sm,\n flexDirection: \"row\",\n gap: 8,\n marginBottom: theme.spacing.sectionGap,\n paddingHorizontal: 10,\n paddingVertical: 6,\n },\n summaryRow: {\n flexDirection: \"row\",\n marginTop: 20,\n },\n totalsBox: {\n width: 250,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\n <PageFooter\n leftText=\"Professional services invoice – Please retain for records\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <View style={styles.headerRow}>\n <View style={styles.companyInfo}>\n <Text variant=\"xl\" weight=\"bold\" noMargin>\n {data.companyName}\n </Text>\n <Text variant=\"sm\" color=\"mutedForeground\" noMargin>\n {data.subtitle}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {data.companyAddress}\n </Text>\n </View>\n <View style={styles.invoiceInfo}>\n <Text\n variant=\"xs\"\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Invoice\n </Text>\n <Text variant=\"lg\" weight=\"bold\" noMargin>\n {data.invoiceNumber}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {data.invoiceDate}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Due: {data.dueDate}\n </Text>\n </View>\n </View>\n {data.projectRef && (\n <View style={styles.projectRef}>\n <Text\n variant=\"xs\"\n weight=\"semibold\"\n color=\"mutedForeground\"\n noMargin\n >\n Project Reference:\n </Text>\n <Text variant=\"xs\" weight=\"bold\" noMargin>\n {data.projectRef}\n </Text>\n </View>\n )}\n <View style={styles.partiesRow}>\n <View style={styles.partyColumn}>\n <Text style={styles.partyLabel} noMargin>\n From (Consultant)\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.consultant.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.consultant.title}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.consultant.email}\n </Text>\n </View>\n <View style={styles.partyColumn}>\n <Text style={styles.partyLabel} noMargin>\n Bill To (Client)\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.client.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.client.company}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.client.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.client.email}\n </Text>\n </View>\n </View>\n <Table variant=\"line\">\n <TableHeader>\n <TableRow header>\n <TableCell>Service Description</TableCell>\n <TableCell align=\"center\">Hours</TableCell>\n <TableCell align=\"right\">Rate ($/hr)</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.services.map((service, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\n <TableRow key={index}>\n <TableCell>{service.description}</TableCell>\n <TableCell align=\"center\">{`${service.hours}`}</TableCell>\n <TableCell align=\"right\">{`$${service.rate}`}</TableCell>\n <TableCell align=\"right\">{`$${(service.hours * service.rate).toLocaleString()}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={styles.summaryRow}>\n <View style={styles.hoursBox}>\n <View style={styles.hoursBadge}>\n <Text\n style={{\n color: theme.colors.primaryForeground,\n fontSize: 9,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n Total Hours: {data.summary.totalHours}\n </Text>\n </View>\n <Text\n variant=\"xs\"\n color=\"mutedForeground\"\n style={{ marginTop: 8 }}\n >\n Payment: {data.paymentTerms.method}\n </Text>\n </View>\n <View style={styles.totalsBox}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toLocaleString()}`,\n },\n { key: \"Tax (5%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Amount Due\",\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.primary,\n fontSize: 14,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </Section>\n {data.notes && (\n <View style={styles.calloutNote}>\n <Text variant=\"xs\" color=\"mutedForeground\">\n {data.notes}\n </Text>\n </View>\n )}\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceConsultantDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceConsultantData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceConsultantContent data={data} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-consultant/invoice-consultant.tsx"
},
{
"path": "registry/bases/forme/blocks/invoice-consultant/invoice-consultant.types.ts",
- "content": "export interface InvoiceConsultantData {\r\n invoiceNumber: string;\r\n invoiceDate: string;\r\n dueDate: string;\r\n companyName: string;\r\n subtitle: string;\r\n companyAddress: string;\r\n consultant: {\r\n name: string;\r\n title: string;\r\n email: string;\r\n };\r\n client: {\r\n name: string;\r\n company: string;\r\n address: string;\r\n email: string;\r\n };\r\n services: {\r\n description: string;\r\n hours: number;\r\n rate: number;\r\n }[];\r\n summary: {\r\n totalHours: number;\r\n subtotal: number;\r\n tax: number;\r\n total: number;\r\n };\r\n paymentTerms: {\r\n dueDate: string;\r\n method: string;\r\n };\r\n projectRef?: string;\r\n notes?: string;\r\n}\r\n",
+ "content": "export interface InvoiceConsultantData {\n invoiceNumber: string;\n invoiceDate: string;\n dueDate: string;\n companyName: string;\n subtitle: string;\n companyAddress: string;\n consultant: {\n name: string;\n title: string;\n email: string;\n };\n client: {\n name: string;\n company: string;\n address: string;\n email: string;\n };\n services: {\n description: string;\n hours: number;\n rate: number;\n }[];\n summary: {\n totalHours: number;\n subtotal: number;\n tax: number;\n total: number;\n };\n paymentTerms: {\n dueDate: string;\n method: string;\n };\n projectRef?: string;\n notes?: string;\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-consultant/invoice-consultant.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/invoice-corporate.json b/apps/web/public/r/forme/invoice-corporate.json
index 17f3c10..80b7989 100644
--- a/apps/web/public/r/forme/invoice-corporate.json
+++ b/apps/web/public/r/forme/invoice-corporate.json
@@ -19,16 +19,16 @@
"files": [
{
"path": "registry/bases/forme/blocks/invoice-corporate/invoice-corporate.tsx",
- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\r\n\r\nimport { KeyValue } from \"@/registry/bases/forme/components/key-value/key-value\";\r\nimport { PageFooter } from \"@/registry/bases/forme/components/page-footer/page-footer\";\r\nimport { PageHeader } from \"@/registry/bases/forme/components/page-header/page-header\";\r\nimport { PdfImage } from \"@/registry/bases/forme/components/pdf-image/pdf-image\";\r\nimport {\r\n Table,\r\n TableBody,\r\n TableCell,\r\n TableHeader,\r\n TableRow,\r\n} from \"@/registry/bases/forme/components/table/table\";\r\nimport { Text } from \"@/registry/bases/forme/components/text/text\";\r\nimport {\r\n PdfcnThemeProvider,\r\n usePdfcnTheme,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { InvoiceCorporateData } from \"./invoice-corporate.types\";\r\n\r\nconst sampleData: InvoiceCorporateData = {\r\n billTo: {\r\n address: \"100 Corporate Plaza, Tower B\",\r\n email: \"[email protected]\",\r\n name: \"Global Industries Ltd.\",\r\n phone: \"+1 (555) 888-9999\",\r\n },\r\n companyAddress: \"Nagpur, IN\",\r\n companyEmail: \"[email protected]\",\r\n companyName: \"pdfcn\",\r\n dueDate: \"March 24, 2026\",\r\n invoiceDate: \"February 22, 2026\",\r\n invoiceNumber: \"INV-2026-004\",\r\n items: [\r\n {\r\n description: \"Enterprise Software License\",\r\n quantity: 5,\r\n unitPrice: 4500,\r\n },\r\n { description: \"Implementation Services\", quantity: 1, unitPrice: 18_000 },\r\n {\r\n description: \"Training Workshop (per session)\",\r\n quantity: 3,\r\n unitPrice: 2500,\r\n },\r\n { description: \"Annual Support Package\", quantity: 1, unitPrice: 8500 },\r\n ],\r\n logo: \"/favicon.png\",\r\n notes:\r\n \"Corporate billing – Net 30 terms apply. For inquiries, contact [email protected]\",\r\n paymentTerms: {\r\n dueDate: \"March 24, 2026\",\r\n gst: \"GSTIN 987654321\",\r\n method: \"Wire Transfer / Corporate Account\",\r\n },\r\n subtitle: \"Innovative PDF Solutions\",\r\n summary: {\r\n subtotal: 56_500,\r\n tax: 4520,\r\n total: 61_020,\r\n },\r\n};\r\n\r\nconst InvoiceCorporateContent = ({ data }: { data: InvoiceCorporateData }) => {\r\n const theme = usePdfcnTheme();\r\n\r\n const styles = StyleSheet.create({\r\n infoColumn: {\r\n flex: 1,\r\n },\r\n infoGrid: {\r\n flexDirection: \"row\",\r\n gap: 24,\r\n marginBottom: theme.spacing.sectionGap,\r\n },\r\n infoLabel: {\r\n color: theme.colors.mutedForeground,\r\n fontSize: 9,\r\n fontWeight: \"bold\",\r\n letterSpacing: 0.6,\r\n marginBottom: 6,\r\n textTransform: \"uppercase\",\r\n },\r\n page: {\r\n backgroundColor: theme.colors.background,\r\n },\r\n summaryCard: {\r\n backgroundColor: theme.colors.muted,\r\n borderRadius: theme.primitives.borderRadius.md,\r\n marginTop: 20,\r\n padding: 16,\r\n },\r\n summaryRow: {\r\n flexDirection: \"row\",\r\n justifyContent: \"flex-end\",\r\n },\r\n });\r\n\r\n return (\r\n <Document title={`Invoice ${data.invoiceNumber}`}>\r\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\r\n <PageFooter\r\n leftText={data.notes}\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={25}\r\n />\r\n <View style={styles.page as never}>\r\n <PageHeader\r\n variant=\"logo-right\"\r\n logo={\r\n <PdfImage\r\n src={data.logo ?? \"/favicon.png\"}\r\n width={56}\r\n height={56}\r\n style={{ margin: 0 }}\r\n />\r\n }\r\n title={data.companyName}\r\n subtitle={`${data.subtitle} · ${data.companyAddress}`}\r\n style={{ marginBottom: theme.spacing.sectionGap }}\r\n />\r\n <View style={styles.infoGrid}>\r\n <View style={styles.infoColumn}>\r\n <Text style={styles.infoLabel} noMargin>\r\n Invoice Details\r\n </Text>\r\n <KeyValue\r\n size=\"sm\"\r\n items={[\r\n { key: \"Invoice #\", value: data.invoiceNumber },\r\n { key: \"Issue Date\", value: data.invoiceDate },\r\n { key: \"Due Date\", value: data.dueDate },\r\n { key: \"Payment\", value: data.paymentTerms.method },\r\n ]}\r\n />\r\n </View>\r\n <View style={styles.infoColumn}>\r\n <Text style={styles.infoLabel} noMargin>\r\n Bill To\r\n </Text>\r\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\r\n {data.billTo.name}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.billTo.address}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.billTo.email}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.billTo.phone}\r\n </Text>\r\n </View>\r\n </View>\r\n <Table variant=\"bordered\">\r\n <TableHeader>\r\n <TableRow header>\r\n <TableCell>Description</TableCell>\r\n <TableCell align=\"center\">Qty</TableCell>\r\n <TableCell align=\"right\">Unit Price</TableCell>\r\n <TableCell align=\"right\">Amount</TableCell>\r\n </TableRow>\r\n </TableHeader>\r\n <TableBody>\r\n {data.items.map((item, index) => (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\r\n <TableRow key={index}>\r\n <TableCell>{item.description}</TableCell>\r\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\r\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\r\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toLocaleString()}`}</TableCell>\r\n </TableRow>\r\n ))}\r\n </TableBody>\r\n </Table>\r\n <View style={styles.summaryCard}>\r\n <View style={styles.summaryRow}>\r\n <View style={{ width: 260 }}>\r\n <KeyValue\r\n size=\"md\"\r\n dividerThickness={1}\r\n dividerColor=\"border\"\r\n items={[\r\n {\r\n key: \"Subtotal\",\r\n value: `$${data.summary.subtotal.toLocaleString()}`,\r\n },\r\n {\r\n key: \"Tax (8%)\",\r\n value: `$${data.summary.tax.toFixed(2)}`,\r\n },\r\n {\r\n key: \"Total Due\",\r\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\r\n value: `$${data.summary.total.toFixed(2)}`,\r\n valueStyle: {\r\n color: theme.colors.primary,\r\n fontSize: 14,\r\n fontWeight: \"bold\",\r\n },\r\n },\r\n ]}\r\n divided\r\n />\r\n </View>\r\n </View>\r\n </View>\r\n </View>\r\n </Page>\r\n </Document>\r\n );\r\n};\r\n\r\nexport const InvoiceCorporateDocument = ({\r\n theme,\r\n data = sampleData,\r\n}: {\r\n theme?: PdfcnTheme;\r\n data?: InvoiceCorporateData;\r\n}) => (\r\n <PdfcnThemeProvider theme={theme}>\r\n <InvoiceCorporateContent data={data} />\r\n </PdfcnThemeProvider>\r\n);\r\n",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { PdfImage } from \"@/components/pdf/pdf-image/pdf-image\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { InvoiceCorporateData } from \"./invoice-corporate.types\";\n\nconst sampleData: InvoiceCorporateData = {\n billTo: {\n address: \"100 Corporate Plaza, Tower B\",\n email: \"[email protected]\",\n name: \"Global Industries Ltd.\",\n phone: \"+1 (555) 888-9999\",\n },\n companyAddress: \"Nagpur, IN\",\n companyEmail: \"[email protected]\",\n companyName: \"pdfcn\",\n dueDate: \"March 24, 2026\",\n invoiceDate: \"February 22, 2026\",\n invoiceNumber: \"INV-2026-004\",\n items: [\n {\n description: \"Enterprise Software License\",\n quantity: 5,\n unitPrice: 4500,\n },\n { description: \"Implementation Services\", quantity: 1, unitPrice: 18_000 },\n {\n description: \"Training Workshop (per session)\",\n quantity: 3,\n unitPrice: 2500,\n },\n { description: \"Annual Support Package\", quantity: 1, unitPrice: 8500 },\n ],\n logo: \"/favicon.png\",\n notes:\n \"Corporate billing – Net 30 terms apply. For inquiries, contact [email protected]\",\n paymentTerms: {\n dueDate: \"March 24, 2026\",\n gst: \"GSTIN 987654321\",\n method: \"Wire Transfer / Corporate Account\",\n },\n subtitle: \"Innovative PDF Solutions\",\n summary: {\n subtotal: 56_500,\n tax: 4520,\n total: 61_020,\n },\n};\n\nconst InvoiceCorporateContent = ({ data }: { data: InvoiceCorporateData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n infoColumn: {\n flex: 1,\n },\n infoGrid: {\n flexDirection: \"row\",\n gap: 24,\n marginBottom: theme.spacing.sectionGap,\n },\n infoLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n fontWeight: \"bold\",\n letterSpacing: 0.6,\n marginBottom: 6,\n textTransform: \"uppercase\",\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n summaryCard: {\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.md,\n marginTop: 20,\n padding: 16,\n },\n summaryRow: {\n flexDirection: \"row\",\n justifyContent: \"flex-end\",\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"logo-right\"\n logo={\n <PdfImage\n src={data.logo ?? \"/favicon.png\"}\n width={56}\n height={56}\n style={{ margin: 0 }}\n />\n }\n title={data.companyName}\n subtitle={`${data.subtitle} · ${data.companyAddress}`}\n style={{ marginBottom: theme.spacing.sectionGap }}\n />\n <View style={styles.infoGrid}>\n <View style={styles.infoColumn}>\n <Text style={styles.infoLabel} noMargin>\n Invoice Details\n </Text>\n <KeyValue\n size=\"sm\"\n items={[\n { key: \"Invoice #\", value: data.invoiceNumber },\n { key: \"Issue Date\", value: data.invoiceDate },\n { key: \"Due Date\", value: data.dueDate },\n { key: \"Payment\", value: data.paymentTerms.method },\n ]}\n />\n </View>\n <View style={styles.infoColumn}>\n <Text style={styles.infoLabel} noMargin>\n Bill To\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.billTo.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.email}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.phone}\n </Text>\n </View>\n </View>\n <Table variant=\"bordered\">\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Unit Price</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toLocaleString()}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <View style={styles.summaryCard}>\n <View style={styles.summaryRow}>\n <View style={{ width: 260 }}>\n <KeyValue\n size=\"md\"\n dividerThickness={1}\n dividerColor=\"border\"\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toLocaleString()}`,\n },\n {\n key: \"Tax (8%)\",\n value: `$${data.summary.tax.toFixed(2)}`,\n },\n {\n key: \"Total Due\",\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.primary,\n fontSize: 14,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </View>\n </View>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceCorporateDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceCorporateData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceCorporateContent data={data} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-corporate/invoice-corporate.tsx"
},
{
"path": "registry/bases/forme/blocks/invoice-corporate/invoice-corporate.types.ts",
- "content": "export interface InvoiceCorporateData {\r\n invoiceNumber: string;\r\n invoiceDate: string;\r\n dueDate: string;\r\n companyName: string;\r\n subtitle: string;\r\n companyAddress: string;\r\n companyEmail: string;\r\n logo?: string;\r\n billTo: {\r\n name: string;\r\n address: string;\r\n email: string;\r\n phone: string;\r\n };\r\n items: {\r\n description: string;\r\n quantity: number;\r\n unitPrice: number;\r\n }[];\r\n summary: {\r\n subtotal: number;\r\n tax: number;\r\n total: number;\r\n };\r\n paymentTerms: {\r\n dueDate: string;\r\n method: string;\r\n gst: string;\r\n };\r\n notes?: string;\r\n}\r\n",
+ "content": "export interface InvoiceCorporateData {\n invoiceNumber: string;\n invoiceDate: string;\n dueDate: string;\n companyName: string;\n subtitle: string;\n companyAddress: string;\n companyEmail: string;\n logo?: string;\n billTo: {\n name: string;\n address: string;\n email: string;\n phone: string;\n };\n items: {\n description: string;\n quantity: number;\n unitPrice: number;\n }[];\n summary: {\n subtotal: number;\n tax: number;\n total: number;\n };\n paymentTerms: {\n dueDate: string;\n method: string;\n gst: string;\n };\n notes?: string;\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-corporate/invoice-corporate.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/invoice-creative.json b/apps/web/public/r/forme/invoice-creative.json
index 760ea6a..0446030 100644
--- a/apps/web/public/r/forme/invoice-creative.json
+++ b/apps/web/public/r/forme/invoice-creative.json
@@ -19,16 +19,16 @@
"files": [
{
"path": "registry/bases/forme/blocks/invoice-creative/invoice-creative.tsx",
- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\r\n\r\nimport { KeyValue } from \"@/registry/bases/forme/components/key-value/key-value\";\r\nimport { PageFooter } from \"@/registry/bases/forme/components/page-footer/page-footer\";\r\nimport { PageHeader } from \"@/registry/bases/forme/components/page-header/page-header\";\r\nimport { Section } from \"@/registry/bases/forme/components/section/section\";\r\nimport {\r\n Table,\r\n TableBody,\r\n TableCell,\r\n TableHeader,\r\n TableRow,\r\n} from \"@/registry/bases/forme/components/table/table\";\r\nimport { Text } from \"@/registry/bases/forme/components/text/text\";\r\nimport {\r\n PdfcnThemeProvider,\r\n usePdfcnTheme,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { InvoiceCreativeData } from \"./invoice-creative.types\";\r\n\r\nconst sampleData: InvoiceCreativeData = {\r\n billTo: {\r\n address: \"250 Design District, Loft 5\",\r\n email: \"[email protected]\",\r\n name: \"Creative Agency Co.\",\r\n phone: \"+1 (555) 321-7654\",\r\n },\r\n companyAddress: \"Nagpur, IN · [email protected]\",\r\n companyName: \"pdfcn\",\r\n dueDate: \"March 26, 2026\",\r\n invoiceDate: \"February 24, 2026\",\r\n invoiceNumber: \"INV-2026-005\",\r\n items: [\r\n { description: \"Brand Identity Design\", quantity: 1, unitPrice: 8500 },\r\n {\r\n description: \"Marketing Collateral Package\",\r\n quantity: 1,\r\n unitPrice: 4200,\r\n },\r\n {\r\n description: \"Social Media Assets (per set)\",\r\n quantity: 4,\r\n unitPrice: 750,\r\n },\r\n { description: \"Motion Graphics (30s)\", quantity: 2, unitPrice: 3500 },\r\n ],\r\n notes:\r\n \"Creative work is protected under copyright. Full usage rights transfer upon payment.\",\r\n paymentTerms: {\r\n dueDate: \"March 26, 2026\",\r\n gst: \"GSTIN 456789123\",\r\n method: \"Credit Card / PayPal / Stripe\",\r\n },\r\n subtitle: \"Innovative PDF Solutions\",\r\n summary: {\r\n subtotal: 22_700,\r\n tax: 1475.5,\r\n total: 24_175.5,\r\n },\r\n};\r\n\r\nconst InvoiceCreativeContent = ({ data }: { data: InvoiceCreativeData }) => {\r\n const theme = usePdfcnTheme();\r\n\r\n const styles = StyleSheet.create({\r\n accentBlock: {\r\n backgroundColor: theme.colors.muted,\r\n borderLeftColor: theme.colors.accent,\r\n borderLeftStyle: \"solid\",\r\n borderLeftWidth: 4,\r\n marginBottom: theme.spacing.sectionGap,\r\n paddingLeft: 14,\r\n paddingVertical: 10,\r\n },\r\n badgeLabel: {\r\n color: theme.colors.primaryForeground,\r\n fontSize: 8,\r\n fontWeight: \"bold\",\r\n letterSpacing: 1.2,\r\n marginBottom: 2,\r\n textTransform: \"uppercase\",\r\n },\r\n badgeNumber: {\r\n color: theme.colors.primaryForeground,\r\n fontSize: 16,\r\n fontWeight: \"bold\",\r\n },\r\n heroSection: {\r\n alignItems: \"center\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n marginBottom: theme.spacing.sectionGap,\r\n },\r\n infoColumn: {\r\n flex: 1,\r\n },\r\n infoGrid: {\r\n flexDirection: \"row\",\r\n gap: 32,\r\n },\r\n invoiceBadge: {\r\n alignItems: \"center\",\r\n backgroundColor: theme.colors.primary,\r\n borderRadius: theme.primitives.borderRadius.md,\r\n paddingHorizontal: 20,\r\n paddingVertical: 14,\r\n },\r\n page: {\r\n backgroundColor: theme.colors.background,\r\n },\r\n sectionLabel: {\r\n color: theme.colors.accent,\r\n fontSize: 8,\r\n fontWeight: \"bold\",\r\n letterSpacing: 0.8,\r\n marginBottom: 6,\r\n textTransform: \"uppercase\",\r\n },\r\n summaryLeft: {\r\n flex: 1,\r\n paddingRight: 20,\r\n },\r\n summaryRight: {\r\n backgroundColor: theme.colors.muted,\r\n borderRadius: theme.primitives.borderRadius.sm,\r\n padding: 14,\r\n width: 240,\r\n },\r\n summarySection: {\r\n flexDirection: \"row\",\r\n marginTop: 24,\r\n },\r\n });\r\n\r\n return (\r\n <Document title={`Invoice ${data.invoiceNumber}`}>\r\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\r\n <PageFooter\r\n variant=\"centered\"\r\n centerText=\"Thank you for choosing us for your creative needs!\"\r\n sticky\r\n pagePadding={25}\r\n />\r\n <View style={styles.page as never}>\r\n <View style={styles.heroSection}>\r\n <View style={{ flex: 1 }}>\r\n <PageHeader\r\n variant=\"centered\"\r\n title={data.companyName}\r\n subtitle={`${data.subtitle} · ${data.companyAddress}`}\r\n marginBottom={0}\r\n />\r\n </View>\r\n <View style={styles.invoiceBadge}>\r\n <Text style={styles.badgeLabel} noMargin>\r\n Invoice\r\n </Text>\r\n <Text style={styles.badgeNumber} noMargin>\r\n {data.invoiceNumber}\r\n </Text>\r\n </View>\r\n </View>\r\n <View style={styles.accentBlock}>\r\n <View style={styles.infoGrid}>\r\n <View style={styles.infoColumn}>\r\n <Text style={styles.sectionLabel} noMargin>\r\n Billed To\r\n </Text>\r\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\r\n {data.billTo.name}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.billTo.address}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.billTo.email} · {data.billTo.phone}\r\n </Text>\r\n </View>\r\n <View style={styles.infoColumn}>\r\n <Text style={styles.sectionLabel} noMargin>\r\n Invoice Info\r\n </Text>\r\n <KeyValue\r\n size=\"sm\"\r\n items={[\r\n { key: \"Issue Date\", value: data.invoiceDate },\r\n { key: \"Due Date\", value: data.dueDate },\r\n { key: \"Payment\", value: data.paymentTerms.method },\r\n ]}\r\n />\r\n </View>\r\n </View>\r\n </View>\r\n <Table variant=\"striped\" zebraStripe>\r\n <TableHeader>\r\n <TableRow header>\r\n <TableCell>Deliverable</TableCell>\r\n <TableCell align=\"center\">Qty</TableCell>\r\n <TableCell align=\"right\">Rate</TableCell>\r\n <TableCell align=\"right\">Amount</TableCell>\r\n </TableRow>\r\n </TableHeader>\r\n <TableBody>\r\n {data.items.map((item, index) => (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\r\n <TableRow key={index}>\r\n <TableCell>{item.description}</TableCell>\r\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\r\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\r\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toLocaleString()}`}</TableCell>\r\n </TableRow>\r\n ))}\r\n </TableBody>\r\n </Table>\r\n <Section noWrap style={styles.summarySection}>\r\n <View style={styles.summaryLeft}>\r\n <Text style={styles.sectionLabel} noMargin>\r\n Notes & Terms\r\n </Text>\r\n <Text variant=\"xs\" color=\"mutedForeground\">\r\n {data.notes}\r\n </Text>\r\n <Text\r\n variant=\"xs\"\r\n color=\"mutedForeground\"\r\n style={{ marginTop: 4 }}\r\n >\r\n GST: {data.paymentTerms.gst}\r\n </Text>\r\n </View>\r\n <View style={styles.summaryRight}>\r\n <KeyValue\r\n size=\"sm\"\r\n dividerThickness={1}\r\n items={[\r\n {\r\n key: \"Subtotal\",\r\n value: `$${data.summary.subtotal.toLocaleString()}`,\r\n },\r\n {\r\n key: \"Tax (6.5%)\",\r\n value: `$${data.summary.tax.toFixed(2)}`,\r\n },\r\n {\r\n key: \"Total\",\r\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\r\n value: `$${data.summary.total.toFixed(2)}`,\r\n valueStyle: {\r\n color: theme.colors.accent,\r\n fontSize: 14,\r\n fontWeight: \"bold\",\r\n },\r\n },\r\n ]}\r\n divided\r\n />\r\n </View>\r\n </Section>\r\n </View>\r\n </Page>\r\n </Document>\r\n );\r\n};\r\n\r\nexport const InvoiceCreativeDocument = ({\r\n theme,\r\n data = sampleData,\r\n}: {\r\n theme?: PdfcnTheme;\r\n data?: InvoiceCreativeData;\r\n}) => (\r\n <PdfcnThemeProvider theme={theme}>\r\n <InvoiceCreativeContent data={data} />\r\n </PdfcnThemeProvider>\r\n);\r\n",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { InvoiceCreativeData } from \"./invoice-creative.types\";\n\nconst sampleData: InvoiceCreativeData = {\n billTo: {\n address: \"250 Design District, Loft 5\",\n email: \"[email protected]\",\n name: \"Creative Agency Co.\",\n phone: \"+1 (555) 321-7654\",\n },\n companyAddress: \"Nagpur, IN · [email protected]\",\n companyName: \"pdfcn\",\n dueDate: \"March 26, 2026\",\n invoiceDate: \"February 24, 2026\",\n invoiceNumber: \"INV-2026-005\",\n items: [\n { description: \"Brand Identity Design\", quantity: 1, unitPrice: 8500 },\n {\n description: \"Marketing Collateral Package\",\n quantity: 1,\n unitPrice: 4200,\n },\n {\n description: \"Social Media Assets (per set)\",\n quantity: 4,\n unitPrice: 750,\n },\n { description: \"Motion Graphics (30s)\", quantity: 2, unitPrice: 3500 },\n ],\n notes:\n \"Creative work is protected under copyright. Full usage rights transfer upon payment.\",\n paymentTerms: {\n dueDate: \"March 26, 2026\",\n gst: \"GSTIN 456789123\",\n method: \"Credit Card / PayPal / Stripe\",\n },\n subtitle: \"Innovative PDF Solutions\",\n summary: {\n subtotal: 22_700,\n tax: 1475.5,\n total: 24_175.5,\n },\n};\n\nconst InvoiceCreativeContent = ({ data }: { data: InvoiceCreativeData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n accentBlock: {\n backgroundColor: theme.colors.muted,\n borderLeftColor: theme.colors.accent,\n borderLeftStyle: \"solid\",\n borderLeftWidth: 4,\n marginBottom: theme.spacing.sectionGap,\n paddingLeft: 14,\n paddingVertical: 10,\n },\n badgeLabel: {\n color: theme.colors.primaryForeground,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n badgeNumber: {\n color: theme.colors.primaryForeground,\n fontSize: 16,\n fontWeight: \"bold\",\n },\n heroSection: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: theme.spacing.sectionGap,\n },\n infoColumn: {\n flex: 1,\n },\n infoGrid: {\n flexDirection: \"row\",\n gap: 32,\n },\n invoiceBadge: {\n alignItems: \"center\",\n backgroundColor: theme.colors.primary,\n borderRadius: theme.primitives.borderRadius.md,\n paddingHorizontal: 20,\n paddingVertical: 14,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n sectionLabel: {\n color: theme.colors.accent,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.8,\n marginBottom: 6,\n textTransform: \"uppercase\",\n },\n summaryLeft: {\n flex: 1,\n paddingRight: 20,\n },\n summaryRight: {\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.sm,\n padding: 14,\n width: 240,\n },\n summarySection: {\n flexDirection: \"row\",\n marginTop: 24,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\n <PageFooter\n variant=\"centered\"\n centerText=\"Thank you for choosing us for your creative needs!\"\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <View style={styles.heroSection}>\n <View style={{ flex: 1 }}>\n <PageHeader\n variant=\"centered\"\n title={data.companyName}\n subtitle={`${data.subtitle} · ${data.companyAddress}`}\n marginBottom={0}\n />\n </View>\n <View style={styles.invoiceBadge}>\n <Text style={styles.badgeLabel} noMargin>\n Invoice\n </Text>\n <Text style={styles.badgeNumber} noMargin>\n {data.invoiceNumber}\n </Text>\n </View>\n </View>\n <View style={styles.accentBlock}>\n <View style={styles.infoGrid}>\n <View style={styles.infoColumn}>\n <Text style={styles.sectionLabel} noMargin>\n Billed To\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.billTo.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.email} · {data.billTo.phone}\n </Text>\n </View>\n <View style={styles.infoColumn}>\n <Text style={styles.sectionLabel} noMargin>\n Invoice Info\n </Text>\n <KeyValue\n size=\"sm\"\n items={[\n { key: \"Issue Date\", value: data.invoiceDate },\n { key: \"Due Date\", value: data.dueDate },\n { key: \"Payment\", value: data.paymentTerms.method },\n ]}\n />\n </View>\n </View>\n </View>\n <Table variant=\"striped\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Deliverable</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Rate</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toLocaleString()}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={styles.summarySection}>\n <View style={styles.summaryLeft}>\n <Text style={styles.sectionLabel} noMargin>\n Notes & Terms\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\">\n {data.notes}\n </Text>\n <Text\n variant=\"xs\"\n color=\"mutedForeground\"\n style={{ marginTop: 4 }}\n >\n GST: {data.paymentTerms.gst}\n </Text>\n </View>\n <View style={styles.summaryRight}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toLocaleString()}`,\n },\n {\n key: \"Tax (6.5%)\",\n value: `$${data.summary.tax.toFixed(2)}`,\n },\n {\n key: \"Total\",\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.accent,\n fontSize: 14,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </Section>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceCreativeDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceCreativeData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceCreativeContent data={data} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-creative/invoice-creative.tsx"
},
{
"path": "registry/bases/forme/blocks/invoice-creative/invoice-creative.types.ts",
- "content": "export interface InvoiceCreativeData {\r\n invoiceNumber: string;\r\n invoiceDate: string;\r\n dueDate: string;\r\n companyName: string;\r\n subtitle: string;\r\n companyAddress: string;\r\n billTo: {\r\n name: string;\r\n address: string;\r\n email: string;\r\n phone: string;\r\n };\r\n items: {\r\n description: string;\r\n quantity: number;\r\n unitPrice: number;\r\n }[];\r\n summary: {\r\n subtotal: number;\r\n tax: number;\r\n total: number;\r\n };\r\n paymentTerms: {\r\n dueDate: string;\r\n method: string;\r\n gst: string;\r\n };\r\n notes?: string;\r\n}\r\n",
+ "content": "export interface InvoiceCreativeData {\n invoiceNumber: string;\n invoiceDate: string;\n dueDate: string;\n companyName: string;\n subtitle: string;\n companyAddress: string;\n billTo: {\n name: string;\n address: string;\n email: string;\n phone: string;\n };\n items: {\n description: string;\n quantity: number;\n unitPrice: number;\n }[];\n summary: {\n subtotal: number;\n tax: number;\n total: number;\n };\n paymentTerms: {\n dueDate: string;\n method: string;\n gst: string;\n };\n notes?: string;\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-creative/invoice-creative.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/invoice-minimal.json b/apps/web/public/r/forme/invoice-minimal.json
index cd3fab9..fc37440 100644
--- a/apps/web/public/r/forme/invoice-minimal.json
+++ b/apps/web/public/r/forme/invoice-minimal.json
@@ -19,16 +19,16 @@
"files": [
{
"path": "registry/bases/forme/blocks/invoice-minimal/invoice-minimal.tsx",
- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\r\n\r\nimport { KeyValue } from \"@/registry/bases/forme/components/key-value/key-value\";\r\nimport { PageFooter } from \"@/registry/bases/forme/components/page-footer/page-footer\";\r\nimport { PageHeader } from \"@/registry/bases/forme/components/page-header/page-header\";\r\nimport { Section } from \"@/registry/bases/forme/components/section/section\";\r\nimport {\r\n Table,\r\n TableBody,\r\n TableCell,\r\n TableHeader,\r\n TableRow,\r\n} from \"@/registry/bases/forme/components/table/table\";\r\nimport { Text } from \"@/registry/bases/forme/components/text/text\";\r\nimport {\r\n PdfcnThemeProvider,\r\n usePdfcnTheme,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { InvoiceMinimalData } from \"./invoice-minimal.types\";\r\n\r\n// Sample data — replace with your own props or data source\r\nconst sampleData: InvoiceMinimalData = {\r\n billTo: {\r\n address: \"500 Enterprise Way, Building A\",\r\n email: \"[email protected]\",\r\n name: \"Enterprise Corp\",\r\n phone: \"+1 (555) 246-8135\",\r\n },\r\n companyAddress: \"Nagpur, IN\",\r\n companyEmail: \"[email protected]\",\r\n companyName: \"pdfcn\",\r\n dueDate: \"March 22, 2026\",\r\n invoiceDate: \"February 20, 2026\",\r\n invoiceNumber: \"INV-2026-003\",\r\n items: [\r\n { description: \"Annual License Plan\", quantity: 1, unitPrice: 25_000 },\r\n { description: \"Support & Maintenance\", quantity: 12, unitPrice: 1500 },\r\n { description: \"Custom Integration\", quantity: 1, unitPrice: 12_000 },\r\n ],\r\n notes:\r\n \"Invoice for annual enterprise subscription. Please retain for your records.\",\r\n paymentTerms: {\r\n dueDate: \"March 22, 2026\",\r\n gst: \"GSTIN 123456789\",\r\n method: \"ACH Transfer / Check\",\r\n },\r\n subtitle: \"Innovative PDF Solutions\",\r\n summary: {\r\n subtotal: 55_000,\r\n tax: 3850,\r\n total: 58_850,\r\n },\r\n};\r\n\r\nconst InvoiceMinimalContent = ({ data }: { data: InvoiceMinimalData }) => {\r\n const theme = usePdfcnTheme();\r\n\r\n const styles = StyleSheet.create({\r\n infoLabel: {\r\n color: theme.colors.primary,\r\n fontSize: 8,\r\n fontWeight: \"bold\",\r\n letterSpacing: 0.8,\r\n marginBottom: 4,\r\n textTransform: \"uppercase\",\r\n },\r\n infoRow: {\r\n flexDirection: \"row\",\r\n marginBottom: 28,\r\n },\r\n invoiceStamp: {\r\n alignSelf: \"flex-start\",\r\n borderColor: theme.colors.primary,\r\n borderRadius: theme.primitives.borderRadius.sm,\r\n borderStyle: \"solid\",\r\n borderWidth: 2,\r\n paddingHorizontal: 12,\r\n paddingVertical: 8,\r\n },\r\n page: {\r\n backgroundColor: theme.colors.background,\r\n },\r\n });\r\n\r\n return (\r\n <Document title={`Invoice ${data.invoiceNumber}`}>\r\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\r\n <PageFooter\r\n leftText={data.notes}\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={25}\r\n />\r\n <View style={styles.page as never}>\r\n <Section\r\n noWrap\r\n style={{\r\n alignItems: \"flex-start\",\r\n flexDirection: \"row\",\r\n marginBottom: theme.spacing.sectionGap,\r\n }}\r\n >\r\n <View style={{ flex: 1 }}>\r\n <PageHeader\r\n variant=\"minimal\"\r\n title={data.companyName}\r\n subtitle={`${data.companyAddress} · ${data.companyEmail}`}\r\n marginBottom={0}\r\n />\r\n </View>\r\n <View style={styles.invoiceStamp}>\r\n <Text\r\n style={{\r\n color: theme.colors.primary,\r\n fontSize: 7,\r\n fontWeight: \"bold\",\r\n textAlign: \"right\",\r\n }}\r\n noMargin\r\n transform=\"uppercase\"\r\n >\r\n Invoice\r\n </Text>\r\n <Text\r\n style={{\r\n color: theme.colors.foreground,\r\n fontSize: 14,\r\n fontWeight: \"bold\",\r\n textAlign: \"right\",\r\n }}\r\n noMargin\r\n >\r\n {data.invoiceNumber}\r\n </Text>\r\n <Text\r\n style={{\r\n color: theme.colors.mutedForeground,\r\n fontSize: 8,\r\n textAlign: \"right\",\r\n }}\r\n noMargin\r\n >\r\n {data.invoiceDate}\r\n </Text>\r\n </View>\r\n </Section>\r\n <View style={styles.infoRow}>\r\n <View style={{ paddingRight: 20, width: 251 }}>\r\n <Text style={styles.infoLabel} noMargin>\r\n Bill To\r\n </Text>\r\n <Text variant=\"sm\" noMargin>\r\n {data.billTo.name}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.billTo.address}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.billTo.email}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.billTo.phone}\r\n </Text>\r\n </View>\r\n <View style={{ width: 232 }}>\r\n <Text style={styles.infoLabel} noMargin>\r\n Invoice Details\r\n </Text>\r\n <KeyValue\r\n size=\"sm\"\r\n items={[\r\n { key: \"Due Date\", value: data.dueDate },\r\n { key: \"Payment\", value: data.paymentTerms.method },\r\n { key: \"GST\", value: data.paymentTerms.gst },\r\n ]}\r\n />\r\n </View>\r\n </View>\r\n <Table variant=\"compact\">\r\n <TableHeader>\r\n <TableRow header>\r\n <TableCell>Description</TableCell>\r\n <TableCell align=\"center\">Qty</TableCell>\r\n <TableCell align=\"right\">Rate</TableCell>\r\n <TableCell align=\"right\">Total</TableCell>\r\n </TableRow>\r\n </TableHeader>\r\n <TableBody>\r\n {data.items.map((item, index) => (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\r\n <TableRow key={index}>\r\n <TableCell>{item.description}</TableCell>\r\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\r\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\r\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\r\n </TableRow>\r\n ))}\r\n </TableBody>\r\n </Table>\r\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 20 }}>\r\n <View style={{ flex: 1 }} />\r\n <View style={{ width: 240 }}>\r\n <KeyValue\r\n size=\"sm\"\r\n dividerThickness={1}\r\n items={[\r\n {\r\n key: \"Subtotal\",\r\n value: `$${data.summary.subtotal.toFixed(2)}`,\r\n },\r\n { key: \"Tax (7%)\", value: `$${data.summary.tax.toFixed(2)}` },\r\n {\r\n key: \"Balance Due\",\r\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\r\n value: `$${data.summary.total.toFixed(2)}`,\r\n valueStyle: {\r\n color: theme.colors.primary,\r\n fontSize: 13,\r\n fontWeight: \"bold\",\r\n },\r\n },\r\n ]}\r\n divided\r\n />\r\n </View>\r\n </Section>\r\n </View>\r\n </Page>\r\n </Document>\r\n );\r\n};\r\n\r\nexport const InvoiceMinimalDocument = ({\r\n theme,\r\n data = sampleData,\r\n}: {\r\n theme?: PdfcnTheme;\r\n data?: InvoiceMinimalData;\r\n}) => (\r\n <PdfcnThemeProvider theme={theme}>\r\n <InvoiceMinimalContent data={data} />\r\n </PdfcnThemeProvider>\r\n);\r\n",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { InvoiceMinimalData } from \"./invoice-minimal.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: InvoiceMinimalData = {\n billTo: {\n address: \"500 Enterprise Way, Building A\",\n email: \"[email protected]\",\n name: \"Enterprise Corp\",\n phone: \"+1 (555) 246-8135\",\n },\n companyAddress: \"Nagpur, IN\",\n companyEmail: \"[email protected]\",\n companyName: \"pdfcn\",\n dueDate: \"March 22, 2026\",\n invoiceDate: \"February 20, 2026\",\n invoiceNumber: \"INV-2026-003\",\n items: [\n { description: \"Annual License Plan\", quantity: 1, unitPrice: 25_000 },\n { description: \"Support & Maintenance\", quantity: 12, unitPrice: 1500 },\n { description: \"Custom Integration\", quantity: 1, unitPrice: 12_000 },\n ],\n notes:\n \"Invoice for annual enterprise subscription. Please retain for your records.\",\n paymentTerms: {\n dueDate: \"March 22, 2026\",\n gst: \"GSTIN 123456789\",\n method: \"ACH Transfer / Check\",\n },\n subtitle: \"Innovative PDF Solutions\",\n summary: {\n subtotal: 55_000,\n tax: 3850,\n total: 58_850,\n },\n};\n\nconst InvoiceMinimalContent = ({ data }: { data: InvoiceMinimalData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n infoLabel: {\n color: theme.colors.primary,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.8,\n marginBottom: 4,\n textTransform: \"uppercase\",\n },\n infoRow: {\n flexDirection: \"row\",\n marginBottom: 28,\n },\n invoiceStamp: {\n alignSelf: \"flex-start\",\n borderColor: theme.colors.primary,\n borderRadius: theme.primitives.borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: 2,\n paddingHorizontal: 12,\n paddingVertical: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <Section\n noWrap\n style={{\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n marginBottom: theme.spacing.sectionGap,\n }}\n >\n <View style={{ flex: 1 }}>\n <PageHeader\n variant=\"minimal\"\n title={data.companyName}\n subtitle={`${data.companyAddress} · ${data.companyEmail}`}\n marginBottom={0}\n />\n </View>\n <View style={styles.invoiceStamp}>\n <Text\n style={{\n color: theme.colors.primary,\n fontSize: 7,\n fontWeight: \"bold\",\n textAlign: \"right\",\n }}\n noMargin\n transform=\"uppercase\"\n >\n Invoice\n </Text>\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: \"bold\",\n textAlign: \"right\",\n }}\n noMargin\n >\n {data.invoiceNumber}\n </Text>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 8,\n textAlign: \"right\",\n }}\n noMargin\n >\n {data.invoiceDate}\n </Text>\n </View>\n </Section>\n <View style={styles.infoRow}>\n <View style={{ paddingRight: 20, width: 251 }}>\n <Text style={styles.infoLabel} noMargin>\n Bill To\n </Text>\n <Text variant=\"sm\" noMargin>\n {data.billTo.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.email}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.phone}\n </Text>\n </View>\n <View style={{ width: 232 }}>\n <Text style={styles.infoLabel} noMargin>\n Invoice Details\n </Text>\n <KeyValue\n size=\"sm\"\n items={[\n { key: \"Due Date\", value: data.dueDate },\n { key: \"Payment\", value: data.paymentTerms.method },\n { key: \"GST\", value: data.paymentTerms.gst },\n ]}\n />\n </View>\n </View>\n <Table variant=\"compact\">\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Rate</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 20 }}>\n <View style={{ flex: 1 }} />\n <View style={{ width: 240 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toFixed(2)}`,\n },\n { key: \"Tax (7%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Balance Due\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.primary,\n fontSize: 13,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </Section>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceMinimalDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceMinimalData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceMinimalContent data={data} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-minimal/invoice-minimal.tsx"
},
{
"path": "registry/bases/forme/blocks/invoice-minimal/invoice-minimal.types.ts",
- "content": "export interface InvoiceMinimalData {\r\n invoiceNumber: string;\r\n invoiceDate: string;\r\n dueDate: string;\r\n companyName: string;\r\n subtitle: string;\r\n companyAddress: string;\r\n companyEmail: string;\r\n billTo: {\r\n name: string;\r\n address: string;\r\n email: string;\r\n phone: string;\r\n };\r\n items: {\r\n description: string;\r\n quantity: number;\r\n unitPrice: number;\r\n }[];\r\n summary: {\r\n subtotal: number;\r\n tax: number;\r\n total: number;\r\n };\r\n paymentTerms: {\r\n dueDate: string;\r\n method: string;\r\n gst: string;\r\n };\r\n notes?: string;\r\n}\r\n",
+ "content": "export interface InvoiceMinimalData {\n invoiceNumber: string;\n invoiceDate: string;\n dueDate: string;\n companyName: string;\n subtitle: string;\n companyAddress: string;\n companyEmail: string;\n billTo: {\n name: string;\n address: string;\n email: string;\n phone: string;\n };\n items: {\n description: string;\n quantity: number;\n unitPrice: number;\n }[];\n summary: {\n subtotal: number;\n tax: number;\n total: number;\n };\n paymentTerms: {\n dueDate: string;\n method: string;\n gst: string;\n };\n notes?: string;\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-minimal/invoice-minimal.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/invoice-modern.json b/apps/web/public/r/forme/invoice-modern.json
index 794bae6..6304f75 100644
--- a/apps/web/public/r/forme/invoice-modern.json
+++ b/apps/web/public/r/forme/invoice-modern.json
@@ -19,16 +19,16 @@
"files": [
{
"path": "registry/bases/forme/blocks/invoice-modern/invoice-modern.tsx",
- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\r\n\r\nimport { KeyValue } from \"@/registry/bases/forme/components/key-value/key-value\";\r\nimport { PageFooter } from \"@/registry/bases/forme/components/page-footer/page-footer\";\r\nimport { PageHeader } from \"@/registry/bases/forme/components/page-header/page-header\";\r\nimport { Section } from \"@/registry/bases/forme/components/section/section\";\r\nimport {\r\n Table,\r\n TableBody,\r\n TableCell,\r\n TableHeader,\r\n TableRow,\r\n} from \"@/registry/bases/forme/components/table/table\";\r\nimport { Text } from \"@/registry/bases/forme/components/text/text\";\r\nimport {\r\n PdfcnThemeProvider,\r\n usePdfcnTheme,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { InvoiceModernData } from \"./invoice-modern.types\";\r\n\r\n// Sample data — replace with your own props or data source\r\nconst sampleData: InvoiceModernData = {\r\n billTo: {\r\n address: \"789 Innovation Blvd, Floor 3\",\r\n email: \"[email protected]\",\r\n name: \"TechStart Solutions\",\r\n phone: \"+1 (555) 987-6543\",\r\n },\r\n companyAddress: \"Nagpur, IN\",\r\n companyEmail: \"[email protected]\",\r\n companyName: \"pdfcn\",\r\n dueDate: \"March 20, 2026\",\r\n invoiceDate: \"February 18, 2026\",\r\n invoiceNumber: \"INV-2026-002\",\r\n items: [\r\n { description: \"API Integration\", quantity: 1, unitPrice: 15_000 },\r\n { description: \"SEO\", quantity: 2, unitPrice: 5500 },\r\n { description: \"Security Audit\", quantity: 1, unitPrice: 7200 },\r\n ],\r\n notes: \"Payment terms: Net 30 days. Thank you for your business!\",\r\n paymentTerms: {\r\n dueDate: \"March 20, 2026\",\r\n gst: \"GSTIN 123456789\",\r\n method: \"Wire Transfer / Bank Account\",\r\n },\r\n subtitle: \"Innovative PDF Solutions\",\r\n summary: {\r\n subtotal: 33_200,\r\n tax: 2324,\r\n total: 35_524,\r\n },\r\n};\r\n\r\nconst InvoiceModernContent = ({ data }: { data: InvoiceModernData }) => {\r\n const theme = usePdfcnTheme();\r\n\r\n const styles = StyleSheet.create({\r\n dividerCol: {\r\n backgroundColor: theme.colors.border,\r\n marginRight: 12,\r\n width: 1,\r\n },\r\n metaCol: {\r\n flex: 1,\r\n paddingRight: 12,\r\n },\r\n metaLabel: {\r\n color: theme.colors.mutedForeground,\r\n fontSize: 8,\r\n fontWeight: \"bold\",\r\n letterSpacing: 0.5,\r\n marginBottom: 3,\r\n textTransform: \"uppercase\",\r\n },\r\n metaRow: {\r\n flexDirection: \"row\",\r\n marginBottom: theme.spacing.sectionGap,\r\n },\r\n metaValue: {\r\n color: theme.colors.foreground,\r\n fontSize: 9,\r\n },\r\n page: {\r\n backgroundColor: theme.colors.background,\r\n },\r\n });\r\n\r\n return (\r\n <Document title={`Invoice ${data.invoiceNumber}`}>\r\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\r\n <PageFooter\r\n leftText={data.notes}\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={25}\r\n />\r\n <View style={styles.page as never}>\r\n <PageHeader\r\n variant=\"branded\"\r\n title={data.companyName}\r\n subtitle={`${data.subtitle} · ${data.companyAddress} · ${data.companyEmail}`}\r\n />\r\n <View style={styles.metaRow}>\r\n <View style={styles.metaCol}>\r\n <Text style={styles.metaLabel} noMargin>\r\n Invoice Number\r\n </Text>\r\n <Text\r\n style={{\r\n ...styles.metaValue,\r\n fontSize: 11,\r\n fontWeight: \"bold\",\r\n }}\r\n noMargin\r\n >\r\n {data.invoiceNumber}\r\n </Text>\r\n </View>\r\n <View style={styles.metaCol}>\r\n <Text style={styles.metaLabel} noMargin>\r\n Invoice Date\r\n </Text>\r\n <Text style={styles.metaValue} noMargin>\r\n {data.invoiceDate}\r\n </Text>\r\n </View>\r\n <View style={styles.metaCol}>\r\n <Text style={styles.metaLabel} noMargin>\r\n Due Date\r\n </Text>\r\n <Text style={styles.metaValue} noMargin>\r\n {data.dueDate}\r\n </Text>\r\n </View>\r\n <View style={styles.dividerCol} />\r\n <View style={{ flex: 2 }}>\r\n <Text style={styles.metaLabel} noMargin>\r\n Billed To\r\n </Text>\r\n <Text\r\n style={{ ...styles.metaValue, fontWeight: \"bold\" }}\r\n noMargin\r\n >\r\n {data.billTo.name}\r\n </Text>\r\n <Text\r\n style={{\r\n ...styles.metaValue,\r\n color: theme.colors.mutedForeground,\r\n }}\r\n noMargin\r\n >\r\n {data.billTo.address}\r\n </Text>\r\n <Text\r\n style={{\r\n ...styles.metaValue,\r\n color: theme.colors.mutedForeground,\r\n }}\r\n noMargin\r\n >\r\n {data.billTo.email}\r\n </Text>\r\n <Text\r\n style={{\r\n ...styles.metaValue,\r\n color: theme.colors.mutedForeground,\r\n }}\r\n noMargin\r\n >\r\n {data.billTo.phone}\r\n </Text>\r\n </View>\r\n </View>\r\n <Table variant=\"primary-header\">\r\n <TableHeader>\r\n <TableRow header>\r\n <TableCell>Description</TableCell>\r\n <TableCell align=\"center\">Qty</TableCell>\r\n <TableCell align=\"right\">Unit Price</TableCell>\r\n <TableCell align=\"right\">Amount</TableCell>\r\n </TableRow>\r\n </TableHeader>\r\n <TableBody>\r\n {data.items.map((item, index) => (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\r\n <TableRow key={index}>\r\n <TableCell>{item.description}</TableCell>\r\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\r\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\r\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\r\n </TableRow>\r\n ))}\r\n </TableBody>\r\n </Table>\r\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 16 }}>\r\n <View style={{ flex: 1, paddingRight: 20 }}>\r\n <Text style={styles.metaLabel} noMargin>\r\n Payment Method\r\n </Text>\r\n <Text variant=\"xs\" noMargin>\r\n {data.paymentTerms.method}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.paymentTerms.gst}\r\n </Text>\r\n </View>\r\n <View style={{ width: 220 }}>\r\n <KeyValue\r\n size=\"sm\"\r\n dividerThickness={1}\r\n items={[\r\n {\r\n key: \"Subtotal\",\r\n value: `$${data.summary.subtotal.toFixed(2)}`,\r\n },\r\n { key: \"Tax (7%)\", value: `$${data.summary.tax.toFixed(2)}` },\r\n {\r\n key: \"Total Due\",\r\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\r\n value: `$${data.summary.total.toFixed(2)}`,\r\n valueStyle: { fontSize: 12, fontWeight: \"bold\" },\r\n },\r\n ]}\r\n divided\r\n />\r\n </View>\r\n </Section>\r\n </View>\r\n </Page>\r\n </Document>\r\n );\r\n};\r\n\r\nexport const InvoiceModernDocument = ({\r\n theme,\r\n data = sampleData,\r\n}: {\r\n theme?: PdfcnTheme;\r\n data?: InvoiceModernData;\r\n}) => (\r\n <PdfcnThemeProvider theme={theme}>\r\n <InvoiceModernContent data={data} />\r\n </PdfcnThemeProvider>\r\n);\r\n",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { InvoiceModernData } from \"./invoice-modern.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: InvoiceModernData = {\n billTo: {\n address: \"789 Innovation Blvd, Floor 3\",\n email: \"[email protected]\",\n name: \"TechStart Solutions\",\n phone: \"+1 (555) 987-6543\",\n },\n companyAddress: \"Nagpur, IN\",\n companyEmail: \"[email protected]\",\n companyName: \"pdfcn\",\n dueDate: \"March 20, 2026\",\n invoiceDate: \"February 18, 2026\",\n invoiceNumber: \"INV-2026-002\",\n items: [\n { description: \"API Integration\", quantity: 1, unitPrice: 15_000 },\n { description: \"SEO\", quantity: 2, unitPrice: 5500 },\n { description: \"Security Audit\", quantity: 1, unitPrice: 7200 },\n ],\n notes: \"Payment terms: Net 30 days. Thank you for your business!\",\n paymentTerms: {\n dueDate: \"March 20, 2026\",\n gst: \"GSTIN 123456789\",\n method: \"Wire Transfer / Bank Account\",\n },\n subtitle: \"Innovative PDF Solutions\",\n summary: {\n subtotal: 33_200,\n tax: 2324,\n total: 35_524,\n },\n};\n\nconst InvoiceModernContent = ({ data }: { data: InvoiceModernData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n dividerCol: {\n backgroundColor: theme.colors.border,\n marginRight: 12,\n width: 1,\n },\n metaCol: {\n flex: 1,\n paddingRight: 12,\n },\n metaLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.5,\n marginBottom: 3,\n textTransform: \"uppercase\",\n },\n metaRow: {\n flexDirection: \"row\",\n marginBottom: theme.spacing.sectionGap,\n },\n metaValue: {\n color: theme.colors.foreground,\n fontSize: 9,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"branded\"\n title={data.companyName}\n subtitle={`${data.subtitle} · ${data.companyAddress} · ${data.companyEmail}`}\n />\n <View style={styles.metaRow}>\n <View style={styles.metaCol}>\n <Text style={styles.metaLabel} noMargin>\n Invoice Number\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n fontSize: 11,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n {data.invoiceNumber}\n </Text>\n </View>\n <View style={styles.metaCol}>\n <Text style={styles.metaLabel} noMargin>\n Invoice Date\n </Text>\n <Text style={styles.metaValue} noMargin>\n {data.invoiceDate}\n </Text>\n </View>\n <View style={styles.metaCol}>\n <Text style={styles.metaLabel} noMargin>\n Due Date\n </Text>\n <Text style={styles.metaValue} noMargin>\n {data.dueDate}\n </Text>\n </View>\n <View style={styles.dividerCol} />\n <View style={{ flex: 2 }}>\n <Text style={styles.metaLabel} noMargin>\n Billed To\n </Text>\n <Text\n style={{ ...styles.metaValue, fontWeight: \"bold\" }}\n noMargin\n >\n {data.billTo.name}\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n color: theme.colors.mutedForeground,\n }}\n noMargin\n >\n {data.billTo.address}\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n color: theme.colors.mutedForeground,\n }}\n noMargin\n >\n {data.billTo.email}\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n color: theme.colors.mutedForeground,\n }}\n noMargin\n >\n {data.billTo.phone}\n </Text>\n </View>\n </View>\n <Table variant=\"primary-header\">\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Unit Price</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 16 }}>\n <View style={{ flex: 1, paddingRight: 20 }}>\n <Text style={styles.metaLabel} noMargin>\n Payment Method\n </Text>\n <Text variant=\"xs\" noMargin>\n {data.paymentTerms.method}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.paymentTerms.gst}\n </Text>\n </View>\n <View style={{ width: 220 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toFixed(2)}`,\n },\n { key: \"Tax (7%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Total Due\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: { fontSize: 12, fontWeight: \"bold\" },\n },\n ]}\n divided\n />\n </View>\n </Section>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceModernDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceModernData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceModernContent data={data} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-modern/invoice-modern.tsx"
},
{
"path": "registry/bases/forme/blocks/invoice-modern/invoice-modern.types.ts",
- "content": "export interface InvoiceModernData {\r\n invoiceNumber: string;\r\n invoiceDate: string;\r\n dueDate: string;\r\n companyName: string;\r\n subtitle: string;\r\n companyAddress: string;\r\n companyEmail: string;\r\n billTo: {\r\n name: string;\r\n address: string;\r\n email: string;\r\n phone: string;\r\n };\r\n items: {\r\n description: string;\r\n quantity: number;\r\n unitPrice: number;\r\n }[];\r\n summary: {\r\n subtotal: number;\r\n tax: number;\r\n total: number;\r\n };\r\n paymentTerms: {\r\n dueDate: string;\r\n method: string;\r\n gst: string;\r\n };\r\n notes?: string;\r\n}\r\n",
+ "content": "export interface InvoiceModernData {\n invoiceNumber: string;\n invoiceDate: string;\n dueDate: string;\n companyName: string;\n subtitle: string;\n companyAddress: string;\n companyEmail: string;\n billTo: {\n name: string;\n address: string;\n email: string;\n phone: string;\n };\n items: {\n description: string;\n quantity: number;\n unitPrice: number;\n }[];\n summary: {\n subtotal: number;\n tax: number;\n total: number;\n };\n paymentTerms: {\n dueDate: string;\n method: string;\n gst: string;\n };\n notes?: string;\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-modern/invoice-modern.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/keep-together.json b/apps/web/public/r/forme/keep-together.json
index 23145c4..63cff2c 100644
--- a/apps/web/public/r/forme/keep-together.json
+++ b/apps/web/public/r/forme/keep-together.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/forme/components/keep-together/keep-together.tsx",
- "content": "import type { ReactNode } from \"react\";\r\n\r\nimport { View } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/types/pdf-components\";\r\n\r\nexport interface KeepTogetherProps {\r\n children?: ReactNode;\r\n minPresenceAhead?: number;\r\n style?: Style;\r\n}\r\n\r\nexport const KeepTogether = ({ children, style }: KeepTogetherProps) => (\r\n <View wrap={false} style={style as never}>\r\n {children}\r\n </View>\r\n);\r\n",
+ "content": "import type { ReactNode } from \"react\";\n\nimport { View } from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/types/pdf-components\";\n\nexport interface KeepTogetherProps {\n children?: ReactNode;\n minPresenceAhead?: number;\n style?: Style;\n}\n\nexport const KeepTogether = ({ children, style }: KeepTogetherProps) => (\n <View wrap={false} style={style as never}>\n {children}\n </View>\n);\n",
"type": "registry:component",
"target": "components/pdf/keep-together/keep-together.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/key-value.json b/apps/web/public/r/forme/key-value.json
index 837bc02..2e2fc43 100644
--- a/apps/web/public/r/forme/key-value.json
+++ b/apps/web/public/r/forme/key-value.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/forme/components/key-value/key-value.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport {\r\n Text as PDFText,\r\n StyleSheet,\r\n View,\r\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type KeyValueDirection = \"horizontal\" | \"vertical\";\r\nexport type KeyValueSize = \"sm\" | \"md\" | \"lg\";\r\n\r\n/**\r\n * A single key-value row with optional per-item color and style overrides.\r\n * Props - `key` | `value` | `valueColor` | `valueStyle` | `keyStyle`\r\n * @see {@link KeyValueEntry}\r\n */\r\nexport interface KeyValueEntry {\r\n key: string;\r\n value: string;\r\n valueColor?: string;\r\n valueStyle?: Style;\r\n keyStyle?: Style;\r\n}\r\n\r\n/**\r\n * List of key-value pairs with layout and style options.\r\n * Props - `items` | `direction` | `divided` | `size` | `labelFlex` | `labelColor` | `valueColor` | `boldValue` | `noWrap` | `dividerColor` | `dividerThickness` | `dividerMargin` | `style`\r\n * @see {@link KeyValueProps}\r\n */\r\nexport interface KeyValueProps extends Omit<PDFComponentProps, \"children\"> {\r\n items: KeyValueEntry[];\r\n /**\r\n * @default 'horizontal'\r\n */\r\n direction?: KeyValueDirection;\r\n /**\r\n * @default false\r\n */\r\n divided?: boolean;\r\n /**\r\n * @default 'md'\r\n */\r\n size?: KeyValueSize;\r\n /**\r\n * @default 1\r\n */\r\n labelFlex?: number;\r\n labelColor?: string;\r\n valueColor?: string;\r\n /**\r\n * @default false\r\n */\r\n boldValue?: boolean;\r\n /**\r\n * @default false\r\n */\r\n noWrap?: boolean;\r\n dividerColor?: string;\r\n dividerThickness?: number;\r\n dividerMargin?: number;\r\n}\r\n\r\nconst createKeyValueStyles = (t: PdfcnTheme) => {\r\n const { spacing, fontWeights } = t.primitives;\r\n const c = t.colors;\r\n const { body } = t.typography;\r\n const keyBase = {\r\n color: c.mutedForeground,\r\n fontFamily: body.fontFamily,\r\n fontWeight: fontWeights.medium,\r\n };\r\n const valueBase = {\r\n color: c.foreground,\r\n fontFamily: body.fontFamily,\r\n fontWeight: fontWeights.regular,\r\n };\r\n return StyleSheet.create({\r\n container: { flexDirection: \"column\", width: \"100%\" },\r\n divider: {\r\n borderBottomColor: c.border,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: spacing[0.5],\r\n },\r\n keyLg: { ...keyBase, fontSize: t.primitives.typography.base },\r\n keyMd: { ...keyBase, fontSize: body.fontSize },\r\n keySm: { ...keyBase, fontSize: t.primitives.typography.xs },\r\n lastRowStretch: {\r\n borderBottomColor: \"#ffffff\",\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: 0.01,\r\n },\r\n rowHorizontal: {\r\n alignItems: \"flex-start\",\r\n flexDirection: \"row\",\r\n paddingVertical: spacing[1],\r\n width: \"100%\",\r\n },\r\n rowVertical: {\r\n flexDirection: \"column\",\r\n marginBottom: t.spacing.paragraphGap,\r\n },\r\n valueBold: { fontWeight: fontWeights.bold },\r\n valueLg: { ...valueBase, fontSize: t.primitives.typography.base },\r\n valueMd: { ...valueBase, fontSize: body.fontSize },\r\n valueSm: { ...valueBase, fontSize: t.primitives.typography.xs },\r\n });\r\n};\r\n\r\nexport const KeyValue = ({\r\n items,\r\n direction = \"horizontal\",\r\n divided = false,\r\n size = \"md\",\r\n labelFlex = 1,\r\n labelColor,\r\n valueColor,\r\n boldValue = false,\r\n noWrap = false,\r\n dividerColor,\r\n dividerThickness,\r\n dividerMargin,\r\n style,\r\n}: KeyValueProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createKeyValueStyles(theme), [theme]);\r\n const keyStyleMap = {\r\n lg: styles.keyLg,\r\n md: styles.keyMd,\r\n sm: styles.keySm,\r\n } as Record<KeyValueSize, Style>;\r\n const valueStyleMap = {\r\n lg: styles.valueLg,\r\n md: styles.valueMd,\r\n sm: styles.valueSm,\r\n } as Record<KeyValueSize, Style>;\r\n const containerStyles: Style[] = [styles.container];\r\n if (style) {\r\n containerStyles.push(...[style].flat());\r\n }\r\n\r\n return (\r\n <View wrap={!noWrap} style={containerStyles as never}>\r\n {items.map((item, index) => {\r\n const isLast = index === items.length - 1;\r\n const keyStyles: Style[] = [keyStyleMap[size]];\r\n if (labelColor) {\r\n keyStyles.push({ color: resolveColor(labelColor, theme.colors) });\r\n }\r\n if (item.keyStyle) {\r\n keyStyles.push(item.keyStyle);\r\n }\r\n const valStyles: Style[] = [valueStyleMap[size]];\r\n if (boldValue) {\r\n valStyles.push(styles.valueBold);\r\n }\r\n const resolvedValueColor = item.valueColor ?? valueColor;\r\n if (resolvedValueColor) {\r\n valStyles.push({\r\n color: resolveColor(resolvedValueColor, theme.colors),\r\n });\r\n }\r\n if (item.valueStyle) {\r\n valStyles.push(item.valueStyle);\r\n }\r\n\r\n if (direction === \"horizontal\") {\r\n const rowStyles: Style[] = [styles.rowHorizontal];\r\n if (divided) {\r\n if (isLast) {\r\n rowStyles.push(styles.lastRowStretch);\r\n } else {\r\n const dividerStyle: Style = {};\r\n if (dividerColor) {\r\n dividerStyle.borderBottomColor = resolveColor(\r\n dividerColor,\r\n theme.colors\r\n );\r\n }\r\n if (dividerThickness) {\r\n dividerStyle.borderBottomWidth = dividerThickness;\r\n }\r\n if (dividerMargin) {\r\n dividerStyle.marginBottom = dividerMargin;\r\n }\r\n rowStyles.push({ ...styles.divider, ...dividerStyle });\r\n }\r\n }\r\n return (\r\n <View key={item.key} style={rowStyles as never}>\r\n <PDFText style={[...keyStyles, { flex: labelFlex }] as never}>\r\n {item.key}\r\n </PDFText>\r\n <PDFText\r\n style={[...valStyles, { flex: 1, textAlign: \"right\" }] as never}\r\n >\r\n {item.value}\r\n </PDFText>\r\n </View>\r\n );\r\n }\r\n\r\n const rowStyles: Style[] = [styles.rowVertical];\r\n if (divided && !isLast) {\r\n rowStyles.push(styles.divider);\r\n }\r\n return (\r\n <View key={item.key} style={rowStyles as never}>\r\n <PDFText style={keyStyles as never}>{item.key}</PDFText>\r\n <PDFText style={valStyles as never}>{item.value}</PDFText>\r\n </View>\r\n );\r\n })}\r\n </View>\r\n );\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type KeyValueDirection = \"horizontal\" | \"vertical\";\nexport type KeyValueSize = \"sm\" | \"md\" | \"lg\";\n\n/**\n * A single key-value row with optional per-item color and style overrides.\n * Props - `key` | `value` | `valueColor` | `valueStyle` | `keyStyle`\n * @see {@link KeyValueEntry}\n */\nexport interface KeyValueEntry {\n key: string;\n value: string;\n valueColor?: string;\n valueStyle?: Style;\n keyStyle?: Style;\n}\n\n/**\n * List of key-value pairs with layout and style options.\n * Props - `items` | `direction` | `divided` | `size` | `labelFlex` | `labelColor` | `valueColor` | `boldValue` | `noWrap` | `dividerColor` | `dividerThickness` | `dividerMargin` | `style`\n * @see {@link KeyValueProps}\n */\nexport interface KeyValueProps extends Omit<PDFComponentProps, \"children\"> {\n items: KeyValueEntry[];\n /**\n * @default 'horizontal'\n */\n direction?: KeyValueDirection;\n /**\n * @default false\n */\n divided?: boolean;\n /**\n * @default 'md'\n */\n size?: KeyValueSize;\n /**\n * @default 1\n */\n labelFlex?: number;\n labelColor?: string;\n valueColor?: string;\n /**\n * @default false\n */\n boldValue?: boolean;\n /**\n * @default false\n */\n noWrap?: boolean;\n dividerColor?: string;\n dividerThickness?: number;\n dividerMargin?: number;\n}\n\nconst createKeyValueStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights } = t.primitives;\n const c = t.colors;\n const { body } = t.typography;\n const keyBase = {\n color: c.mutedForeground,\n fontFamily: body.fontFamily,\n fontWeight: fontWeights.medium,\n };\n const valueBase = {\n color: c.foreground,\n fontFamily: body.fontFamily,\n fontWeight: fontWeights.regular,\n };\n return StyleSheet.create({\n container: { flexDirection: \"column\", width: \"100%\" },\n divider: {\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n },\n keyLg: { ...keyBase, fontSize: t.primitives.typography.base },\n keyMd: { ...keyBase, fontSize: body.fontSize },\n keySm: { ...keyBase, fontSize: t.primitives.typography.xs },\n lastRowStretch: {\n borderBottomColor: \"#ffffff\",\n borderBottomStyle: \"solid\",\n borderBottomWidth: 0.01,\n },\n rowHorizontal: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n paddingVertical: spacing[1],\n width: \"100%\",\n },\n rowVertical: {\n flexDirection: \"column\",\n marginBottom: t.spacing.paragraphGap,\n },\n valueBold: { fontWeight: fontWeights.bold },\n valueLg: { ...valueBase, fontSize: t.primitives.typography.base },\n valueMd: { ...valueBase, fontSize: body.fontSize },\n valueSm: { ...valueBase, fontSize: t.primitives.typography.xs },\n });\n};\n\nexport const KeyValue = ({\n items,\n direction = \"horizontal\",\n divided = false,\n size = \"md\",\n labelFlex = 1,\n labelColor,\n valueColor,\n boldValue = false,\n noWrap = false,\n dividerColor,\n dividerThickness,\n dividerMargin,\n style,\n}: KeyValueProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createKeyValueStyles(theme), [theme]);\n const keyStyleMap = {\n lg: styles.keyLg,\n md: styles.keyMd,\n sm: styles.keySm,\n } as Record<KeyValueSize, Style>;\n const valueStyleMap = {\n lg: styles.valueLg,\n md: styles.valueMd,\n sm: styles.valueSm,\n } as Record<KeyValueSize, Style>;\n const containerStyles: Style[] = [styles.container];\n if (style) {\n containerStyles.push(...[style].flat());\n }\n\n return (\n <View wrap={!noWrap} style={containerStyles as never}>\n {items.map((item, index) => {\n const isLast = index === items.length - 1;\n const keyStyles: Style[] = [keyStyleMap[size]];\n if (labelColor) {\n keyStyles.push({ color: resolveColor(labelColor, theme.colors) });\n }\n if (item.keyStyle) {\n keyStyles.push(item.keyStyle);\n }\n const valStyles: Style[] = [valueStyleMap[size]];\n if (boldValue) {\n valStyles.push(styles.valueBold);\n }\n const resolvedValueColor = item.valueColor ?? valueColor;\n if (resolvedValueColor) {\n valStyles.push({\n color: resolveColor(resolvedValueColor, theme.colors),\n });\n }\n if (item.valueStyle) {\n valStyles.push(item.valueStyle);\n }\n\n if (direction === \"horizontal\") {\n const rowStyles: Style[] = [styles.rowHorizontal];\n if (divided) {\n if (isLast) {\n rowStyles.push(styles.lastRowStretch);\n } else {\n const dividerStyle: Style = {};\n if (dividerColor) {\n dividerStyle.borderBottomColor = resolveColor(\n dividerColor,\n theme.colors\n );\n }\n if (dividerThickness) {\n dividerStyle.borderBottomWidth = dividerThickness;\n }\n if (dividerMargin) {\n dividerStyle.marginBottom = dividerMargin;\n }\n rowStyles.push({ ...styles.divider, ...dividerStyle });\n }\n }\n return (\n <View key={item.key} style={rowStyles as never}>\n <PDFText style={[...keyStyles, { flex: labelFlex }] as never}>\n {item.key}\n </PDFText>\n <PDFText\n style={[...valStyles, { flex: 1, textAlign: \"right\" }] as never}\n >\n {item.value}\n </PDFText>\n </View>\n );\n }\n\n const rowStyles: Style[] = [styles.rowVertical];\n if (divided && !isLast) {\n rowStyles.push(styles.divider);\n }\n return (\n <View key={item.key} style={rowStyles as never}>\n <PDFText style={keyStyles as never}>{item.key}</PDFText>\n <PDFText style={valStyles as never}>{item.value}</PDFText>\n </View>\n );\n })}\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/key-value/key-value.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/lesson-plan.json b/apps/web/public/r/forme/lesson-plan.json
index 63a35a3..8b42dd8 100644
--- a/apps/web/public/r/forme/lesson-plan.json
+++ b/apps/web/public/r/forme/lesson-plan.json
@@ -18,7 +18,7 @@
"files": [
{
"path": "registry/bases/forme/blocks/lesson-plan/lesson-plan.tsx",
- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { PageFooter } from \"@/registry/bases/forme/components/page-footer/page-footer\";\nimport { PageHeader } from \"@/registry/bases/forme/components/page-header/page-header\";\nimport { Section } from \"@/registry/bases/forme/components/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/registry/bases/forme/components/table/table\";\nimport { Text } from \"@/registry/bases/forme/components/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type { LessonPlanProps } from \"./lesson-plan.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: LessonPlanProps = {\n accentColor: \"#7c3aed\",\n assessment: {\n formative: [\"Exit ticket\", \"Observation during guided practice\"],\n summative: [\"Chapter quiz\"],\n },\n date: \"September 15, 2026\",\n differentiation: [\n \"Provide equation mats for visual learners\",\n \"Allow calculator use for students with processing difficulties\",\n \"Offer extension problems for advanced learners\",\n ],\n duration: \"50 minutes\",\n essentialQuestion:\n \"How can we represent real-world relationships using linear equations?\",\n gradeLevel: \"8th Grade\",\n homework: \"Complete worksheet problems 11-20\",\n lessonTitle: \"Introduction to Linear Equations\",\n materials: [\"Graph paper\", \"Rulers\", \"Calculator\", \"Whiteboard markers\"],\n objectives: [\n \"Define linear equations\",\n \"Graph linear equations on a coordinate plane\",\n \"Solve simple linear equations\",\n ],\n sequence: [\n {\n activity: \"Warm-up\",\n description: \"Review solving one-step equations\",\n notes: \"5 problems on the board\",\n time: \"5 min\",\n },\n {\n activity: \"Introduction\",\n description: \"Define linear equations, show examples\",\n notes: \"Use real-world context\",\n time: \"10 min\",\n },\n {\n activity: \"Guided Practice\",\n description: \"Work through 3 examples together\",\n notes: \"Check for understanding\",\n time: \"15 min\",\n },\n {\n activity: \"Independent Practice\",\n description: \"Complete worksheet problems 1-10\",\n notes: \"Circulate and support\",\n time: \"15 min\",\n },\n {\n activity: \"Closure\",\n description: \"Exit ticket: solve one linear equation\",\n notes: \"Collect before dismissal\",\n time: \"5 min\",\n },\n ],\n standards: [\"CCSS.MATH.8.EE.B.6\", \"CCSS.MATH.8.EE.C.7\"],\n subject: \"Mathematics\",\n teacherName: \"Ms. Johnson\",\n topic: \"Linear Equations\",\n};\n\nconst REFLECTION_LINE_KEYS = Array.from(\n { length: 8 },\n (_, line) => `reflection-line-${line}`\n);\n\nconst COLUMN_WIDTHS = { activity: 104, notes: 140, time: 56 };\n\nconst LessonPlanContent = ({ data }: { data: LessonPlanProps }) => {\n const theme = usePdfcnTheme();\n const rule = {\n borderBottomColor: theme.colors.border,\n borderBottomStyle: \"solid\" as const,\n borderBottomWidth: 1,\n };\n\n const styles = StyleSheet.create({\n block: {\n marginBottom: 16,\n },\n colHalf: {\n flex: 2,\n paddingRight: 20,\n },\n colQuarter: {\n flex: 1,\n paddingRight: 10,\n },\n infoRow: {\n ...rule,\n flexDirection: \"row\",\n marginBottom: 16,\n paddingBottom: 12,\n },\n intro: {\n marginBottom: 3,\n },\n label: {\n fontSize: 9,\n fontWeight: \"bold\",\n marginBottom: 4,\n },\n listMarker: {\n width: 12,\n },\n listRow: {\n flexDirection: \"row\",\n marginBottom: 3,\n },\n listText: {\n flex: 1,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n reflectionLine: {\n ...rule,\n height: 24,\n },\n row: {\n flexDirection: \"row\",\n },\n });\n\n const pageMargin = {\n bottom: theme.spacing.page.marginBottom,\n left: theme.spacing.page.marginLeft,\n right: theme.spacing.page.marginRight,\n top: theme.spacing.page.marginTop,\n };\n\n const renderLabel = (label: string) => (\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n {label}\n </Text>\n );\n\n const renderList = (items: string[] = [], numbered = false) =>\n items.length > 0 ? (\n items.map((item, index) => (\n <View key={item} style={styles.listRow}>\n <View style={styles.listMarker}>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {numbered ? `${index + 1}.` : \"•\"}\n </Text>\n </View>\n <View style={styles.listText}>\n <Text variant=\"xs\" noMargin>\n {item}\n </Text>\n </View>\n </View>\n ))\n ) : (\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n —\n </Text>\n );\n\n const info = [\n { label: \"Subject\", value: data.subject },\n { label: \"Grade Level\", value: data.gradeLevel },\n { label: \"Teacher\", value: data.teacherName },\n { label: \"Duration\", value: data.duration },\n ];\n\n const footerText = `${data.subject} · ${data.gradeLevel} · ${data.lessonTitle}`;\n\n return (\n <Document title={`Lesson Plan — ${data.lessonTitle}`}>\n <Page margin={pageMargin} size=\"A4\">\n <PageFooter\n leftText={footerText}\n rightText=\"Page 1 of 2\"\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"simple\"\n title={data.lessonTitle}\n subtitle={\n data.topic ? `Lesson Plan · ${data.topic}` : \"Lesson Plan\"\n }\n rightText={data.date}\n marginBottom={16}\n />\n\n <View style={styles.infoRow}>\n {info.map((item) => (\n <View key={item.label} style={styles.colQuarter}>\n {renderLabel(item.label)}\n <Text variant=\"xs\" weight=\"medium\" noMargin>\n {item.value}\n </Text>\n </View>\n ))}\n </View>\n\n {data.essentialQuestion ? (\n <Section\n variant=\"highlight\"\n accentColor={data.accentColor}\n spacing=\"none\"\n padding=\"sm\"\n style={styles.block}\n >\n {renderLabel(\"Essential Question\")}\n <Text variant=\"sm\" weight=\"medium\" noMargin>\n {data.essentialQuestion}\n </Text>\n </Section>\n ) : null}\n\n <View style={{ ...styles.row, ...styles.block }}>\n <View style={styles.colHalf}>\n {renderLabel(\"Objectives\")}\n <Text\n variant=\"xs\"\n color=\"mutedForeground\"\n style={styles.intro}\n noMargin\n >\n Students will be able to (SWBAT):\n </Text>\n {renderList(data.objectives, true)}\n </View>\n {data.standards?.length ? (\n <View style={styles.colQuarter}>\n {renderLabel(\"Standards\")}\n {renderList(data.standards)}\n </View>\n ) : null}\n <View style={styles.colQuarter}>\n {renderLabel(\"Materials\")}\n {renderList(data.materials)}\n </View>\n </View>\n\n <View>\n {renderLabel(\"Lesson Sequence\")}\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell width={COLUMN_WIDTHS.time}>Time</TableCell>\n <TableCell width={COLUMN_WIDTHS.activity}>Activity</TableCell>\n <TableCell>Description</TableCell>\n <TableCell width={COLUMN_WIDTHS.notes}>Notes</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.sequence.map((item) => (\n <TableRow key={`${item.time}-${item.activity}`}>\n <TableCell width={COLUMN_WIDTHS.time}>\n {item.time}\n </TableCell>\n <TableCell width={COLUMN_WIDTHS.activity}>\n {item.activity}\n </TableCell>\n <TableCell>{item.description}</TableCell>\n <TableCell width={COLUMN_WIDTHS.notes}>\n {item.notes ?? \"—\"}\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </View>\n </View>\n </Page>\n\n <Page margin={pageMargin} size=\"A4\">\n <PageFooter\n leftText={footerText}\n rightText=\"Page 2 of 2\"\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n {data.differentiation?.length ? (\n <View style={styles.block}>\n {renderLabel(\"Differentiation\")}\n {renderList(data.differentiation)}\n </View>\n ) : null}\n\n <View style={{ ...styles.row, ...styles.block }}>\n <View style={styles.colHalf}>\n {renderLabel(\"Formative Assessment\")}\n {renderList(data.assessment.formative)}\n </View>\n <View style={styles.colHalf}>\n {renderLabel(\"Summative Assessment\")}\n {renderList(data.assessment.summative)}\n </View>\n </View>\n\n {data.homework ? (\n <View style={styles.block}>\n {renderLabel(\"Homework\")}\n <Text variant=\"xs\" noMargin>\n {data.homework}\n </Text>\n </View>\n ) : null}\n\n <View>\n {renderLabel(\"Teacher Reflection\")}\n {data.reflection ? (\n <Text variant=\"xs\" noMargin>\n {data.reflection}\n </Text>\n ) : null}\n {REFLECTION_LINE_KEYS.map((key) => (\n <View key={key} style={styles.reflectionLine} />\n ))}\n </View>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const LessonPlanDocument = ({\n theme,\n data,\n ...props\n}: {\n theme?: PdfcnTheme;\n data?: LessonPlanProps;\n} & Partial<LessonPlanProps>) => (\n <PdfcnThemeProvider theme={theme}>\n <LessonPlanContent data={{ ...sampleData, ...data, ...props }} />\n </PdfcnThemeProvider>\n);\n",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { LessonPlanProps } from \"./lesson-plan.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: LessonPlanProps = {\n accentColor: \"#7c3aed\",\n assessment: {\n formative: [\"Exit ticket\", \"Observation during guided practice\"],\n summative: [\"Chapter quiz\"],\n },\n date: \"September 15, 2026\",\n differentiation: [\n \"Provide equation mats for visual learners\",\n \"Allow calculator use for students with processing difficulties\",\n \"Offer extension problems for advanced learners\",\n ],\n duration: \"50 minutes\",\n essentialQuestion:\n \"How can we represent real-world relationships using linear equations?\",\n gradeLevel: \"8th Grade\",\n homework: \"Complete worksheet problems 11-20\",\n lessonTitle: \"Introduction to Linear Equations\",\n materials: [\"Graph paper\", \"Rulers\", \"Calculator\", \"Whiteboard markers\"],\n objectives: [\n \"Define linear equations\",\n \"Graph linear equations on a coordinate plane\",\n \"Solve simple linear equations\",\n ],\n sequence: [\n {\n activity: \"Warm-up\",\n description: \"Review solving one-step equations\",\n notes: \"5 problems on the board\",\n time: \"5 min\",\n },\n {\n activity: \"Introduction\",\n description: \"Define linear equations, show examples\",\n notes: \"Use real-world context\",\n time: \"10 min\",\n },\n {\n activity: \"Guided Practice\",\n description: \"Work through 3 examples together\",\n notes: \"Check for understanding\",\n time: \"15 min\",\n },\n {\n activity: \"Independent Practice\",\n description: \"Complete worksheet problems 1-10\",\n notes: \"Circulate and support\",\n time: \"15 min\",\n },\n {\n activity: \"Closure\",\n description: \"Exit ticket: solve one linear equation\",\n notes: \"Collect before dismissal\",\n time: \"5 min\",\n },\n ],\n standards: [\"CCSS.MATH.8.EE.B.6\", \"CCSS.MATH.8.EE.C.7\"],\n subject: \"Mathematics\",\n teacherName: \"Ms. Johnson\",\n topic: \"Linear Equations\",\n};\n\nconst REFLECTION_LINE_KEYS = Array.from(\n { length: 8 },\n (_, line) => `reflection-line-${line}`\n);\n\nconst COLUMN_WIDTHS = { activity: 104, notes: 140, time: 56 };\n\nconst LessonPlanContent = ({ data }: { data: LessonPlanProps }) => {\n const theme = usePdfcnTheme();\n const rule = {\n borderBottomColor: theme.colors.border,\n borderBottomStyle: \"solid\" as const,\n borderBottomWidth: 1,\n };\n\n const styles = StyleSheet.create({\n block: {\n marginBottom: 16,\n },\n colHalf: {\n flex: 2,\n paddingRight: 20,\n },\n colQuarter: {\n flex: 1,\n paddingRight: 10,\n },\n infoRow: {\n ...rule,\n flexDirection: \"row\",\n marginBottom: 16,\n paddingBottom: 12,\n },\n intro: {\n marginBottom: 3,\n },\n label: {\n fontSize: 9,\n fontWeight: \"bold\",\n marginBottom: 4,\n },\n listMarker: {\n width: 12,\n },\n listRow: {\n flexDirection: \"row\",\n marginBottom: 3,\n },\n listText: {\n flex: 1,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n reflectionLine: {\n ...rule,\n height: 24,\n },\n row: {\n flexDirection: \"row\",\n },\n });\n\n const pageMargin = {\n bottom: theme.spacing.page.marginBottom,\n left: theme.spacing.page.marginLeft,\n right: theme.spacing.page.marginRight,\n top: theme.spacing.page.marginTop,\n };\n\n const renderLabel = (label: string) => (\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n {label}\n </Text>\n );\n\n const renderList = (items: string[] = [], numbered = false) =>\n items.length > 0 ? (\n items.map((item, index) => (\n <View key={item} style={styles.listRow}>\n <View style={styles.listMarker}>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {numbered ? `${index + 1}.` : \"•\"}\n </Text>\n </View>\n <View style={styles.listText}>\n <Text variant=\"xs\" noMargin>\n {item}\n </Text>\n </View>\n </View>\n ))\n ) : (\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n —\n </Text>\n );\n\n const info = [\n { label: \"Subject\", value: data.subject },\n { label: \"Grade Level\", value: data.gradeLevel },\n { label: \"Teacher\", value: data.teacherName },\n { label: \"Duration\", value: data.duration },\n ];\n\n const footerText = `${data.subject} · ${data.gradeLevel} · ${data.lessonTitle}`;\n\n return (\n <Document title={`Lesson Plan — ${data.lessonTitle}`}>\n <Page margin={pageMargin} size=\"A4\">\n <PageFooter\n leftText={footerText}\n rightText=\"Page 1 of 2\"\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"simple\"\n title={data.lessonTitle}\n subtitle={\n data.topic ? `Lesson Plan · ${data.topic}` : \"Lesson Plan\"\n }\n rightText={data.date}\n marginBottom={16}\n />\n\n <View style={styles.infoRow}>\n {info.map((item) => (\n <View key={item.label} style={styles.colQuarter}>\n {renderLabel(item.label)}\n <Text variant=\"xs\" weight=\"medium\" noMargin>\n {item.value}\n </Text>\n </View>\n ))}\n </View>\n\n {data.essentialQuestion ? (\n <Section\n variant=\"highlight\"\n accentColor={data.accentColor}\n spacing=\"none\"\n padding=\"sm\"\n style={styles.block}\n >\n {renderLabel(\"Essential Question\")}\n <Text variant=\"sm\" weight=\"medium\" noMargin>\n {data.essentialQuestion}\n </Text>\n </Section>\n ) : null}\n\n <View style={{ ...styles.row, ...styles.block }}>\n <View style={styles.colHalf}>\n {renderLabel(\"Objectives\")}\n <Text\n variant=\"xs\"\n color=\"mutedForeground\"\n style={styles.intro}\n noMargin\n >\n Students will be able to (SWBAT):\n </Text>\n {renderList(data.objectives, true)}\n </View>\n {data.standards?.length ? (\n <View style={styles.colQuarter}>\n {renderLabel(\"Standards\")}\n {renderList(data.standards)}\n </View>\n ) : null}\n <View style={styles.colQuarter}>\n {renderLabel(\"Materials\")}\n {renderList(data.materials)}\n </View>\n </View>\n\n <View>\n {renderLabel(\"Lesson Sequence\")}\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell width={COLUMN_WIDTHS.time}>Time</TableCell>\n <TableCell width={COLUMN_WIDTHS.activity}>Activity</TableCell>\n <TableCell>Description</TableCell>\n <TableCell width={COLUMN_WIDTHS.notes}>Notes</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.sequence.map((item) => (\n <TableRow key={`${item.time}-${item.activity}`}>\n <TableCell width={COLUMN_WIDTHS.time}>\n {item.time}\n </TableCell>\n <TableCell width={COLUMN_WIDTHS.activity}>\n {item.activity}\n </TableCell>\n <TableCell>{item.description}</TableCell>\n <TableCell width={COLUMN_WIDTHS.notes}>\n {item.notes ?? \"—\"}\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </View>\n </View>\n </Page>\n\n <Page margin={pageMargin} size=\"A4\">\n <PageFooter\n leftText={footerText}\n rightText=\"Page 2 of 2\"\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n {data.differentiation?.length ? (\n <View style={styles.block}>\n {renderLabel(\"Differentiation\")}\n {renderList(data.differentiation)}\n </View>\n ) : null}\n\n <View style={{ ...styles.row, ...styles.block }}>\n <View style={styles.colHalf}>\n {renderLabel(\"Formative Assessment\")}\n {renderList(data.assessment.formative)}\n </View>\n <View style={styles.colHalf}>\n {renderLabel(\"Summative Assessment\")}\n {renderList(data.assessment.summative)}\n </View>\n </View>\n\n {data.homework ? (\n <View style={styles.block}>\n {renderLabel(\"Homework\")}\n <Text variant=\"xs\" noMargin>\n {data.homework}\n </Text>\n </View>\n ) : null}\n\n <View>\n {renderLabel(\"Teacher Reflection\")}\n {data.reflection ? (\n <Text variant=\"xs\" noMargin>\n {data.reflection}\n </Text>\n ) : null}\n {REFLECTION_LINE_KEYS.map((key) => (\n <View key={key} style={styles.reflectionLine} />\n ))}\n </View>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const LessonPlanDocument = ({\n theme,\n data,\n ...props\n}: {\n theme?: PdfcnTheme;\n data?: LessonPlanProps;\n} & Partial<LessonPlanProps>) => (\n <PdfcnThemeProvider theme={theme}>\n <LessonPlanContent data={{ ...sampleData, ...data, ...props }} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/lesson-plan/lesson-plan.tsx"
},
@@ -30,4 +30,4 @@
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/link.json b/apps/web/public/r/forme/link.json
index a732b38..e82ef28 100644
--- a/apps/web/public/r/forme/link.json
+++ b/apps/web/public/r/forme/link.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/forme/components/link/link.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport {\r\n Link as PDFLink,\r\n StyleSheet,\r\n Text as PDFText,\r\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type LinkVariant = \"default\" | \"muted\" | \"primary\";\r\nexport type LinkUnderline = \"always\" | \"none\";\r\n\r\n/**\r\n * Clickable hyperlink for PDF documents.\r\n * Props - `href` | `children` | `align` | `color` | `variant` | `underline` | `style`\r\n * @see {@link LinkProps}\r\n */\r\nexport interface LinkProps extends PDFComponentProps {\r\n href: string;\r\n /**\r\n * @default 'left'\r\n */\r\n align?: \"left\" | \"center\" | \"right\";\r\n color?: string;\r\n /**\r\n * @default 'default'\r\n */\r\n variant?: LinkVariant;\r\n /**\r\n * @default 'always'\r\n */\r\n underline?: LinkUnderline;\r\n}\r\n\r\nconst createLinkStyles = (t: PdfcnTheme) => {\r\n const { fontWeights } = t.primitives;\r\n const base = {\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n lineHeight: t.typography.body.lineHeight,\r\n marginBottom: t.spacing.paragraphGap,\r\n };\r\n return StyleSheet.create({\r\n default: {\r\n ...base,\r\n color: t.colors.accent,\r\n fontWeight: fontWeights.medium,\r\n textDecoration: \"underline\",\r\n },\r\n muted: {\r\n ...base,\r\n color: t.colors.mutedForeground,\r\n fontWeight: fontWeights.regular,\r\n textDecoration: \"underline\",\r\n },\r\n primary: {\r\n ...base,\r\n color: t.colors.primary,\r\n fontWeight: fontWeights.semibold,\r\n textDecoration: \"underline\",\r\n },\r\n underlineAlways: { textDecoration: \"underline\" },\r\n underlineNone: { textDecoration: \"none\" },\r\n });\r\n};\r\n\r\nexport const Link = ({\r\n href,\r\n align,\r\n color,\r\n variant = \"default\",\r\n underline,\r\n children,\r\n style,\r\n}: LinkProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createLinkStyles(theme), [theme]);\r\n const variantMap = {\r\n default: styles.default,\r\n muted: styles.muted,\r\n primary: styles.primary,\r\n };\r\n const underlineMap = {\r\n always: styles.underlineAlways,\r\n none: styles.underlineNone,\r\n };\r\n const styleArray: Style[] = [variantMap[variant]];\r\n if (underline && underline in underlineMap) {\r\n styleArray.push(underlineMap[underline]);\r\n }\r\n const semantic = {} as Style;\r\n if (align) {\r\n semantic.textAlign = align;\r\n }\r\n if (color) {\r\n semantic.color = resolveColor(color, theme.colors);\r\n }\r\n if (Object.keys(semantic).length > 0) {\r\n styleArray.push(semantic);\r\n }\r\n if (style) {\r\n styleArray.push(...[style].flat());\r\n }\r\n return (\r\n <PDFText style={styleArray as never}>\r\n <PDFLink href={href} style={styleArray as never}>\r\n {children}\r\n </PDFLink>\r\n </PDFText>\r\n );\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Link as PDFLink,\n StyleSheet,\n Text as PDFText,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type LinkVariant = \"default\" | \"muted\" | \"primary\";\nexport type LinkUnderline = \"always\" | \"none\";\n\n/**\n * Clickable hyperlink for PDF documents.\n * Props - `href` | `children` | `align` | `color` | `variant` | `underline` | `style`\n * @see {@link LinkProps}\n */\nexport interface LinkProps extends PDFComponentProps {\n href: string;\n /**\n * @default 'left'\n */\n align?: \"left\" | \"center\" | \"right\";\n color?: string;\n /**\n * @default 'default'\n */\n variant?: LinkVariant;\n /**\n * @default 'always'\n */\n underline?: LinkUnderline;\n}\n\nconst createLinkStyles = (t: PdfcnTheme) => {\n const { fontWeights } = t.primitives;\n const base = {\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n lineHeight: t.typography.body.lineHeight,\n marginBottom: t.spacing.paragraphGap,\n };\n return StyleSheet.create({\n default: {\n ...base,\n color: t.colors.accent,\n fontWeight: fontWeights.medium,\n textDecoration: \"underline\",\n },\n muted: {\n ...base,\n color: t.colors.mutedForeground,\n fontWeight: fontWeights.regular,\n textDecoration: \"underline\",\n },\n primary: {\n ...base,\n color: t.colors.primary,\n fontWeight: fontWeights.semibold,\n textDecoration: \"underline\",\n },\n underlineAlways: { textDecoration: \"underline\" },\n underlineNone: { textDecoration: \"none\" },\n });\n};\n\nexport const Link = ({\n href,\n align,\n color,\n variant = \"default\",\n underline,\n children,\n style,\n}: LinkProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createLinkStyles(theme), [theme]);\n const variantMap = {\n default: styles.default,\n muted: styles.muted,\n primary: styles.primary,\n };\n const underlineMap = {\n always: styles.underlineAlways,\n none: styles.underlineNone,\n };\n const styleArray: Style[] = [variantMap[variant]];\n if (underline && underline in underlineMap) {\n styleArray.push(underlineMap[underline]);\n }\n const semantic = {} as Style;\n if (align) {\n semantic.textAlign = align;\n }\n if (color) {\n semantic.color = resolveColor(color, theme.colors);\n }\n if (Object.keys(semantic).length > 0) {\n styleArray.push(semantic);\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return (\n <PDFText style={styleArray as never}>\n <PDFLink href={href} style={styleArray as never}>\n {children}\n </PDFLink>\n </PDFText>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/link/link.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/list.json b/apps/web/public/r/forme/list.json
index 71dbdc9..640b715 100644
--- a/apps/web/public/r/forme/list.json
+++ b/apps/web/public/r/forme/list.json
@@ -13,22 +13,22 @@
"files": [
{
"path": "registry/bases/forme/components/list/list.styles.ts",
- "content": "import { StyleSheet } from \"@formepdf/react\";\r\n\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\n/**\r\n * Creates all list styles derived from the active theme.\r\n * @param t - The resolved PdfcnTheme instance.\r\n */\r\nexport const createListStyles = (t: PdfcnTheme) => {\r\n const { borderRadius, spacing, fontWeights, typography } = t.primitives;\r\n\r\n return StyleSheet.create({\r\n checkBox: {\r\n alignItems: \"center\",\r\n backgroundColor: t.colors.background,\r\n borderColor: t.colors.border,\r\n borderRadius: 3,\r\n borderStyle: \"solid\",\r\n borderWidth: 1.5,\r\n height: spacing[4],\r\n justifyContent: \"center\",\r\n marginRight: spacing[2],\r\n width: spacing[4],\r\n },\r\n checkBoxChecked: {\r\n backgroundColor: t.colors.success,\r\n borderColor: t.colors.success,\r\n },\r\n checklistTextWrap: {\r\n flex: 1,\r\n marginLeft: spacing[2],\r\n },\r\n childrenContainer: {\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n marginLeft: spacing[5],\r\n marginTop: spacing[1],\r\n },\r\n container: {\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n marginBottom: t.spacing.componentGap,\r\n width: \"100%\",\r\n },\r\n descriptiveAccent: {\r\n backgroundColor: t.colors.primary,\r\n borderRadius: borderRadius.sm,\r\n marginRight: spacing[3],\r\n minHeight: spacing[4],\r\n width: 3,\r\n },\r\n descriptiveContent: {\r\n flex: 1,\r\n },\r\n descriptiveDesc: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.sm,\r\n lineHeight: t.typography.body.lineHeight,\r\n marginTop: 1,\r\n },\r\n descriptiveTitle: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n fontWeight: fontWeights.semibold,\r\n lineHeight: t.typography.body.lineHeight,\r\n },\r\n iconBox: {\r\n alignItems: \"center\",\r\n backgroundColor: t.colors.primary,\r\n borderRadius: borderRadius.md,\r\n height: spacing[5],\r\n justifyContent: \"center\",\r\n marginRight: spacing[2],\r\n width: spacing[5],\r\n },\r\n iconMark: {\r\n color: t.colors.primaryForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: 9,\r\n fontWeight: fontWeights.bold,\r\n },\r\n itemRow: {\r\n alignItems: \"flex-start\",\r\n flexDirection: \"row\",\r\n },\r\n itemRowCenter: {\r\n alignItems: \"center\",\r\n flexDirection: \"row\",\r\n },\r\n itemRowGapMd: { marginBottom: spacing[3] },\r\n itemRowGapSm: { marginBottom: spacing[2] },\r\n itemRowGapXs: { marginBottom: spacing[1] },\r\n itemText: {\r\n // No flex here — Text nodes with flex shorthand get flexBasis:0, which causes\r\n // Yoga to under-measure multi-line text height → overlapping rows.\r\n // flex:1 must live on the wrapping View, not on the Text itself.\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n lineHeight: t.typography.body.lineHeight,\r\n },\r\n itemTextBold: {\r\n fontWeight: fontWeights.semibold,\r\n },\r\n itemTextSub: {\r\n // Same: no flex — see itemText comment.\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize - 0.5,\r\n lineHeight: t.typography.body.lineHeight,\r\n },\r\n itemTextWrap: {\r\n // Companion to itemText / itemTextSub. Apply this to the View that wraps\r\n // the Text so flex expansion happens at the View level, not the Text level.\r\n flex: 1,\r\n },\r\n markerBulletDot: {\r\n backgroundColor: t.colors.primary,\r\n borderRadius: 3,\r\n height: 5,\r\n width: 5,\r\n },\r\n markerBulletSubDot: {\r\n backgroundColor: \"transparent\",\r\n borderColor: t.colors.mutedForeground,\r\n borderRadius: 2,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n height: 4,\r\n width: 4,\r\n },\r\n markerBulletSubWrap: {\r\n alignItems: \"center\",\r\n justifyContent: \"flex-start\",\r\n marginTop: spacing[1],\r\n width: spacing[4],\r\n },\r\n markerBulletWrap: {\r\n alignItems: \"center\",\r\n justifyContent: \"flex-start\",\r\n marginTop: spacing[1],\r\n width: spacing[4],\r\n },\r\n markerNumberBadge: {\r\n alignItems: \"center\",\r\n backgroundColor: t.colors.primary,\r\n borderRadius: spacing[5],\r\n height: spacing[5],\r\n justifyContent: \"center\",\r\n marginRight: spacing[2],\r\n width: spacing[5],\r\n },\r\n markerNumberText: {\r\n color: t.colors.primaryForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.xs,\r\n fontWeight: fontWeights.bold,\r\n },\r\n });\r\n};\r\n",
+ "content": "import { StyleSheet } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\n/**\n * Creates all list styles derived from the active theme.\n * @param t - The resolved PdfcnTheme instance.\n */\nexport const createListStyles = (t: PdfcnTheme) => {\n const { borderRadius, spacing, fontWeights, typography } = t.primitives;\n\n return StyleSheet.create({\n checkBox: {\n alignItems: \"center\",\n backgroundColor: t.colors.background,\n borderColor: t.colors.border,\n borderRadius: 3,\n borderStyle: \"solid\",\n borderWidth: 1.5,\n height: spacing[4],\n justifyContent: \"center\",\n marginRight: spacing[2],\n width: spacing[4],\n },\n checkBoxChecked: {\n backgroundColor: t.colors.success,\n borderColor: t.colors.success,\n },\n checklistTextWrap: {\n flex: 1,\n marginLeft: spacing[2],\n },\n childrenContainer: {\n display: \"flex\",\n flexDirection: \"column\",\n marginLeft: spacing[5],\n marginTop: spacing[1],\n },\n container: {\n display: \"flex\",\n flexDirection: \"column\",\n marginBottom: t.spacing.componentGap,\n width: \"100%\",\n },\n descriptiveAccent: {\n backgroundColor: t.colors.primary,\n borderRadius: borderRadius.sm,\n marginRight: spacing[3],\n minHeight: spacing[4],\n width: 3,\n },\n descriptiveContent: {\n flex: 1,\n },\n descriptiveDesc: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n lineHeight: t.typography.body.lineHeight,\n marginTop: 1,\n },\n descriptiveTitle: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: t.typography.body.lineHeight,\n },\n iconBox: {\n alignItems: \"center\",\n backgroundColor: t.colors.primary,\n borderRadius: borderRadius.md,\n height: spacing[5],\n justifyContent: \"center\",\n marginRight: spacing[2],\n width: spacing[5],\n },\n iconMark: {\n color: t.colors.primaryForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: 9,\n fontWeight: fontWeights.bold,\n },\n itemRow: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n },\n itemRowCenter: {\n alignItems: \"center\",\n flexDirection: \"row\",\n },\n itemRowGapMd: { marginBottom: spacing[3] },\n itemRowGapSm: { marginBottom: spacing[2] },\n itemRowGapXs: { marginBottom: spacing[1] },\n itemText: {\n // No flex here — Text nodes with flex shorthand get flexBasis:0, which causes\n // Yoga to under-measure multi-line text height → overlapping rows.\n // flex:1 must live on the wrapping View, not on the Text itself.\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n lineHeight: t.typography.body.lineHeight,\n },\n itemTextBold: {\n fontWeight: fontWeights.semibold,\n },\n itemTextSub: {\n // Same: no flex — see itemText comment.\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize - 0.5,\n lineHeight: t.typography.body.lineHeight,\n },\n itemTextWrap: {\n // Companion to itemText / itemTextSub. Apply this to the View that wraps\n // the Text so flex expansion happens at the View level, not the Text level.\n flex: 1,\n },\n markerBulletDot: {\n backgroundColor: t.colors.primary,\n borderRadius: 3,\n height: 5,\n width: 5,\n },\n markerBulletSubDot: {\n backgroundColor: \"transparent\",\n borderColor: t.colors.mutedForeground,\n borderRadius: 2,\n borderStyle: \"solid\",\n borderWidth: 1,\n height: 4,\n width: 4,\n },\n markerBulletSubWrap: {\n alignItems: \"center\",\n justifyContent: \"flex-start\",\n marginTop: spacing[1],\n width: spacing[4],\n },\n markerBulletWrap: {\n alignItems: \"center\",\n justifyContent: \"flex-start\",\n marginTop: spacing[1],\n width: spacing[4],\n },\n markerNumberBadge: {\n alignItems: \"center\",\n backgroundColor: t.colors.primary,\n borderRadius: spacing[5],\n height: spacing[5],\n justifyContent: \"center\",\n marginRight: spacing[2],\n width: spacing[5],\n },\n markerNumberText: {\n color: t.colors.primaryForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.bold,\n },\n });\n};\n",
"type": "registry:component",
"target": "components/pdf/list/list.styles.ts"
},
{
"path": "registry/bases/forme/components/list/list.tsx",
- "content": "import type React from \"react\";\r\n\r\nimport {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport {\r\n Text as PDFText,\r\n View,\r\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\n\r\nimport { createListStyles } from \"./list.styles\";\r\nimport type { ListItem, ListVariant, PdfListProps } from \"./list.types\";\r\n\r\ntype Styles = ReturnType<typeof createListStyles>;\r\ntype GapProp = \"xs\" | \"sm\" | \"md\";\r\n\r\nconst getGapStyle = (gap: GapProp, styles: Styles): Style => {\r\n if (gap === \"xs\") {\r\n return styles.itemRowGapXs;\r\n }\r\n if (gap === \"md\") {\r\n return styles.itemRowGapMd;\r\n }\r\n return styles.itemRowGapSm;\r\n};\r\n\r\nconst buildRowStyles = (\r\n index: number,\r\n total: number,\r\n gap: GapProp,\r\n styles: Styles,\r\n align: \"start\" | \"center\" = \"start\"\r\n): Style[] => {\r\n const row: Style[] = [\r\n align === \"center\" ? styles.itemRowCenter : styles.itemRow,\r\n ];\r\n if (index !== total - 1) {\r\n row.push(getGapStyle(gap, styles));\r\n }\r\n return row;\r\n};\r\n\r\n/** Bullet dot marker — solid filled for level 0, outline ring for nested levels. */\r\nconst dotMarker = (level: number, styles: Styles): React.ReactElement =>\r\n level === 0 ? (\r\n <View style={styles.markerBulletWrap}>\r\n <View style={styles.markerBulletDot} />\r\n </View>\r\n ) : (\r\n <View style={styles.markerBulletSubWrap}>\r\n <View style={styles.markerBulletSubDot} />\r\n </View>\r\n );\r\n\r\n// eslint-disable-next-line no-use-before-define, prefer-const\r\nlet renderBulletItem: (\r\n item: ListItem,\r\n index: number,\r\n total: number,\r\n gap: GapProp,\r\n styles: Styles,\r\n level: number\r\n) => React.ReactElement;\r\n// eslint-disable-next-line no-use-before-define, prefer-const\r\nlet renderMultiLevelItem: (\r\n item: ListItem,\r\n index: number,\r\n total: number,\r\n gap: GapProp,\r\n styles: Styles,\r\n level: number\r\n) => React.ReactElement;\r\n\r\nconst renderNumberedItem = (\r\n item: ListItem,\r\n index: number,\r\n total: number,\r\n gap: GapProp,\r\n styles: Styles\r\n): React.ReactElement => (\r\n <View\r\n key={index}\r\n style={buildRowStyles(index, total, gap, styles, \"center\") as never}\r\n >\r\n <View style={styles.markerNumberBadge}>\r\n <PDFText style={styles.markerNumberText}>{`${index + 1}`}</PDFText>\r\n </View>\r\n <View style={styles.itemTextWrap}>\r\n <PDFText style={styles.itemText}>{item.text}</PDFText>\r\n </View>\r\n </View>\r\n);\r\n\r\nconst renderChecklistItem = (\r\n item: ListItem,\r\n index: number,\r\n total: number,\r\n gap: GapProp,\r\n styles: Styles\r\n): React.ReactElement => {\r\n const isChecked = item.checked ?? true;\r\n return (\r\n <View\r\n key={index}\r\n style={buildRowStyles(index, total, gap, styles, \"center\") as never}\r\n >\r\n <View\r\n style={\r\n [styles.checkBox, isChecked ? styles.checkBoxChecked : {}] as never\r\n }\r\n ></View>\r\n <View style={styles.checklistTextWrap}>\r\n <PDFText style={styles.itemText}>{item.text}</PDFText>\r\n </View>\r\n </View>\r\n );\r\n};\r\n\r\nconst renderIconItem = (\r\n item: ListItem,\r\n index: number,\r\n total: number,\r\n gap: GapProp,\r\n styles: Styles\r\n): React.ReactElement => (\r\n <View\r\n key={index}\r\n style={buildRowStyles(index, total, gap, styles, \"center\") as never}\r\n >\r\n <View style={styles.iconBox}>\r\n <PDFText style={styles.iconMark}>★</PDFText>\r\n </View>\r\n <View style={styles.itemTextWrap}>\r\n <PDFText style={styles.itemText}>{item.text}</PDFText>\r\n </View>\r\n </View>\r\n);\r\n\r\nconst renderDescriptiveItem = (\r\n item: ListItem,\r\n index: number,\r\n total: number,\r\n gap: GapProp,\r\n styles: Styles\r\n): React.ReactElement => (\r\n <View key={index} style={buildRowStyles(index, total, gap, styles) as never}>\r\n <View style={styles.descriptiveAccent} />\r\n <View style={styles.descriptiveContent}>\r\n <PDFText style={styles.descriptiveTitle}>{item.text}</PDFText>\r\n {item.description ? (\r\n <PDFText style={styles.descriptiveDesc}>{item.description}</PDFText>\r\n ) : null}\r\n </View>\r\n </View>\r\n);\r\n\r\nconst renderItem = (\r\n item: ListItem,\r\n index: number,\r\n total: number,\r\n variant: ListVariant,\r\n gap: GapProp,\r\n styles: Styles,\r\n level: number\r\n): React.ReactElement | null => {\r\n switch (variant) {\r\n case \"bullet\": {\r\n return renderBulletItem(item, index, total, gap, styles, level);\r\n }\r\n case \"numbered\": {\r\n return renderNumberedItem(item, index, total, gap, styles);\r\n }\r\n case \"checklist\": {\r\n return renderChecklistItem(item, index, total, gap, styles);\r\n }\r\n case \"icon\": {\r\n return renderIconItem(item, index, total, gap, styles);\r\n }\r\n case \"multi-level\": {\r\n return renderMultiLevelItem(item, index, total, gap, styles, level);\r\n }\r\n case \"descriptive\": {\r\n return renderDescriptiveItem(item, index, total, gap, styles);\r\n }\r\n default: {\r\n break;\r\n }\r\n }\r\n return null;\r\n};\r\n\r\nconst renderItemList = (\r\n items: ListItem[],\r\n variant: ListVariant,\r\n gap: GapProp,\r\n styles: Styles,\r\n level: number\r\n): React.ReactElement => (\r\n <View style={level > 0 ? styles.childrenContainer : undefined}>\r\n {items.map((item, index) =>\r\n renderItem(item, index, items.length, variant, gap, styles, level)\r\n )}\r\n </View>\r\n);\r\n\r\nrenderBulletItem = (item, index, total, gap, styles, level) => (\r\n <View key={index}>\r\n <View style={buildRowStyles(index, total, gap, styles) as never}>\r\n {dotMarker(level, styles)}\r\n <View style={styles.itemTextWrap}>\r\n <PDFText style={styles.itemText}>{item.text}</PDFText>\r\n </View>\r\n </View>\r\n {item.children && item.children.length > 0\r\n ? renderItemList(item.children, \"bullet\", gap, styles, level + 1)\r\n : null}\r\n </View>\r\n);\r\n\r\nrenderMultiLevelItem = (item, index, total, gap, styles, level) => (\r\n <View key={index}>\r\n <View style={buildRowStyles(index, total, gap, styles) as never}>\r\n {dotMarker(level, styles)}\r\n <View style={styles.itemTextWrap}>\r\n <PDFText\r\n style={\r\n [\r\n level === 0 ? styles.itemText : styles.itemTextSub,\r\n level === 0 ? styles.itemTextBold : {},\r\n ] as never\r\n }\r\n >\r\n {item.text}\r\n </PDFText>\r\n </View>\r\n </View>\r\n {item.children && item.children.length > 0\r\n ? renderItemList(item.children, \"multi-level\", gap, styles, level + 1)\r\n : null}\r\n </View>\r\n);\r\n\r\nexport const PdfList = ({\r\n items,\r\n variant = \"bullet\",\r\n gap = \"sm\",\r\n style,\r\n _level = 0,\r\n}: PdfListProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createListStyles(theme), [theme]);\r\n\r\n const containerStyles: Style[] = [styles.container];\r\n if (_level > 0) {\r\n containerStyles.push(styles.childrenContainer);\r\n }\r\n const styleArray = style ? [...containerStyles, style] : containerStyles;\r\n\r\n return (\r\n <View style={styleArray as never}>\r\n {items.map((item, index) =>\r\n renderItem(item, index, items.length, variant, gap, styles, _level)\r\n )}\r\n </View>\r\n );\r\n};\r\n",
+ "content": "import type React from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Text as PDFText,\n View,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\n\nimport { createListStyles } from \"./list.styles\";\nimport type { ListItem, ListVariant, PdfListProps } from \"./list.types\";\n\ntype Styles = ReturnType<typeof createListStyles>;\ntype GapProp = \"xs\" | \"sm\" | \"md\";\n\nconst getGapStyle = (gap: GapProp, styles: Styles): Style => {\n if (gap === \"xs\") {\n return styles.itemRowGapXs;\n }\n if (gap === \"md\") {\n return styles.itemRowGapMd;\n }\n return styles.itemRowGapSm;\n};\n\nconst buildRowStyles = (\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles,\n align: \"start\" | \"center\" = \"start\"\n): Style[] => {\n const row: Style[] = [\n align === \"center\" ? styles.itemRowCenter : styles.itemRow,\n ];\n if (index !== total - 1) {\n row.push(getGapStyle(gap, styles));\n }\n return row;\n};\n\n/** Bullet dot marker — solid filled for level 0, outline ring for nested levels. */\nconst dotMarker = (level: number, styles: Styles): React.ReactElement =>\n level === 0 ? (\n <View style={styles.markerBulletWrap}>\n <View style={styles.markerBulletDot} />\n </View>\n ) : (\n <View style={styles.markerBulletSubWrap}>\n <View style={styles.markerBulletSubDot} />\n </View>\n );\n\n// eslint-disable-next-line no-use-before-define, prefer-const\nlet renderBulletItem: (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles,\n level: number\n) => React.ReactElement;\n// eslint-disable-next-line no-use-before-define, prefer-const\nlet renderMultiLevelItem: (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles,\n level: number\n) => React.ReactElement;\n\nconst renderNumberedItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => (\n <View\n key={index}\n style={buildRowStyles(index, total, gap, styles, \"center\") as never}\n >\n <View style={styles.markerNumberBadge}>\n <PDFText style={styles.markerNumberText}>{`${index + 1}`}</PDFText>\n </View>\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n);\n\nconst renderChecklistItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => {\n const isChecked = item.checked ?? true;\n return (\n <View\n key={index}\n style={buildRowStyles(index, total, gap, styles, \"center\") as never}\n >\n <View\n style={\n [styles.checkBox, isChecked ? styles.checkBoxChecked : {}] as never\n }\n ></View>\n <View style={styles.checklistTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n );\n};\n\nconst renderIconItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => (\n <View\n key={index}\n style={buildRowStyles(index, total, gap, styles, \"center\") as never}\n >\n <View style={styles.iconBox}>\n <PDFText style={styles.iconMark}>★</PDFText>\n </View>\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n);\n\nconst renderDescriptiveItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => (\n <View key={index} style={buildRowStyles(index, total, gap, styles) as never}>\n <View style={styles.descriptiveAccent} />\n <View style={styles.descriptiveContent}>\n <PDFText style={styles.descriptiveTitle}>{item.text}</PDFText>\n {item.description ? (\n <PDFText style={styles.descriptiveDesc}>{item.description}</PDFText>\n ) : null}\n </View>\n </View>\n);\n\nconst renderItem = (\n item: ListItem,\n index: number,\n total: number,\n variant: ListVariant,\n gap: GapProp,\n styles: Styles,\n level: number\n): React.ReactElement | null => {\n switch (variant) {\n case \"bullet\": {\n return renderBulletItem(item, index, total, gap, styles, level);\n }\n case \"numbered\": {\n return renderNumberedItem(item, index, total, gap, styles);\n }\n case \"checklist\": {\n return renderChecklistItem(item, index, total, gap, styles);\n }\n case \"icon\": {\n return renderIconItem(item, index, total, gap, styles);\n }\n case \"multi-level\": {\n return renderMultiLevelItem(item, index, total, gap, styles, level);\n }\n case \"descriptive\": {\n return renderDescriptiveItem(item, index, total, gap, styles);\n }\n default: {\n break;\n }\n }\n return null;\n};\n\nconst renderItemList = (\n items: ListItem[],\n variant: ListVariant,\n gap: GapProp,\n styles: Styles,\n level: number\n): React.ReactElement => (\n <View style={level > 0 ? styles.childrenContainer : undefined}>\n {items.map((item, index) =>\n renderItem(item, index, items.length, variant, gap, styles, level)\n )}\n </View>\n);\n\nrenderBulletItem = (item, index, total, gap, styles, level) => (\n <View key={index}>\n <View style={buildRowStyles(index, total, gap, styles) as never}>\n {dotMarker(level, styles)}\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n {item.children && item.children.length > 0\n ? renderItemList(item.children, \"bullet\", gap, styles, level + 1)\n : null}\n </View>\n);\n\nrenderMultiLevelItem = (item, index, total, gap, styles, level) => (\n <View key={index}>\n <View style={buildRowStyles(index, total, gap, styles) as never}>\n {dotMarker(level, styles)}\n <View style={styles.itemTextWrap}>\n <PDFText\n style={\n [\n level === 0 ? styles.itemText : styles.itemTextSub,\n level === 0 ? styles.itemTextBold : {},\n ] as never\n }\n >\n {item.text}\n </PDFText>\n </View>\n </View>\n {item.children && item.children.length > 0\n ? renderItemList(item.children, \"multi-level\", gap, styles, level + 1)\n : null}\n </View>\n);\n\nexport const PdfList = ({\n items,\n variant = \"bullet\",\n gap = \"sm\",\n style,\n _level = 0,\n}: PdfListProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createListStyles(theme), [theme]);\n\n const containerStyles: Style[] = [styles.container];\n if (_level > 0) {\n containerStyles.push(styles.childrenContainer);\n }\n const styleArray = style ? [...containerStyles, style] : containerStyles;\n\n return (\n <View style={styleArray as never}>\n {items.map((item, index) =>\n renderItem(item, index, items.length, variant, gap, styles, _level)\n )}\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/list/list.tsx"
},
{
"path": "registry/bases/forme/components/list/list.types.ts",
- "content": "import type { Style } from \"@formepdf/react\";\r\n\r\n/** List visual style variant. */\r\nexport type ListVariant =\r\n | \"bullet\"\r\n | \"numbered\"\r\n | \"checklist\"\r\n | \"icon\"\r\n | \"multi-level\"\r\n | \"descriptive\";\r\n\r\n/**\r\n * A single list item, optionally with nested children.\r\n * Props - `text` | `description` | `checked` | `children`\r\n * @see {@link ListItem}\r\n */\r\nexport interface ListItem {\r\n text: string;\r\n description?: string;\r\n checked?: boolean;\r\n children?: ListItem[];\r\n}\r\n\r\n/**\r\n * List of items with multiple style variants including bullet, numbered, checklist, and descriptive.\r\n * Props - `items` | `variant` | `gap` | `style` | `_level` | `noWrap`\r\n * @see {@link PdfListProps}\r\n */\r\nexport interface PdfListProps {\r\n items: ListItem[];\r\n /**\r\n * @default 'bullet'\r\n */\r\n variant?: ListVariant;\r\n /**\r\n * @default 'sm'\r\n */\r\n gap?: \"xs\" | \"sm\" | \"md\";\r\n style?: Style;\r\n _level?: number;\r\n /**\r\n * @default false\r\n */\r\n noWrap?: boolean;\r\n}\r\n",
+ "content": "import type { Style } from \"@formepdf/react\";\n\n/** List visual style variant. */\nexport type ListVariant =\n | \"bullet\"\n | \"numbered\"\n | \"checklist\"\n | \"icon\"\n | \"multi-level\"\n | \"descriptive\";\n\n/**\n * A single list item, optionally with nested children.\n * Props - `text` | `description` | `checked` | `children`\n * @see {@link ListItem}\n */\nexport interface ListItem {\n text: string;\n description?: string;\n checked?: boolean;\n children?: ListItem[];\n}\n\n/**\n * List of items with multiple style variants including bullet, numbered, checklist, and descriptive.\n * Props - `items` | `variant` | `gap` | `style` | `_level` | `noWrap`\n * @see {@link PdfListProps}\n */\nexport interface PdfListProps {\n items: ListItem[];\n /**\n * @default 'bullet'\n */\n variant?: ListVariant;\n /**\n * @default 'sm'\n */\n gap?: \"xs\" | \"sm\" | \"md\";\n style?: Style;\n _level?: number;\n /**\n * @default false\n */\n noWrap?: boolean;\n}\n",
"type": "registry:component",
"target": "components/pdf/list/list.types.ts"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/medical-intake-form.json b/apps/web/public/r/forme/medical-intake-form.json
index cc360a3..69f06e7 100644
--- a/apps/web/public/r/forme/medical-intake-form.json
+++ b/apps/web/public/r/forme/medical-intake-form.json
@@ -22,16 +22,16 @@
"files": [
{
"path": "registry/bases/forme/blocks/medical-intake-form/medical-intake-form.tsx",
- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { PdfForm } from \"@/registry/bases/forme/components/form/form\";\nimport { PdfList } from \"@/registry/bases/forme/components/list/list\";\nimport { PageFooter } from \"@/registry/bases/forme/components/page-footer/page-footer\";\nimport { PageHeader } from \"@/registry/bases/forme/components/page-header/page-header\";\nimport { PdfImage } from \"@/registry/bases/forme/components/pdf-image/pdf-image\";\nimport { Section } from \"@/registry/bases/forme/components/section/section\";\nimport { PdfSignatureBlock } from \"@/registry/bases/forme/components/signature/signature\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/registry/bases/forme/components/table/table\";\nimport { Text } from \"@/registry/bases/forme/components/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type { MedicalIntakeFormProps } from \"./medical-intake-form.types\";\n\nconst FORM_VERSION = \"Form v1.0 · Revised 09/2026\";\nconst FORM_STYLE = { marginBottom: 0 };\n\nconst SECOND_PAGE_MARGIN_BOTTOM = 44;\nconst SECOND_PAGE_MARGIN_TOP = 24;\n\nconst MEDICAL_CONDITIONS = [\n \"Diabetes\",\n \"High Blood Pressure\",\n \"Heart Disease\",\n \"Asthma\",\n \"COPD\",\n \"Cancer\",\n \"Stroke\",\n \"Thyroid Disorder\",\n \"Kidney Disease\",\n \"Liver Disease\",\n \"Seizures / Epilepsy\",\n \"Other\",\n];\n\nconst CONSENT_ACKNOWLEDGMENTS = [\n { checked: false, text: \"I have read and understand the consent above.\" },\n { checked: false, text: \"I have received the Notice of Privacy Practices.\" },\n];\n\nconst MEDICATION_ROWS = [\n \"medication-1\",\n \"medication-2\",\n \"medication-3\",\n \"medication-4\",\n];\n\nconst ALLERGY_ROWS = [\"allergy-1\", \"allergy-2\", \"allergy-3\"];\n\nconst BLANK_CELL = <View style={{ minHeight: 14 }} />;\n\nconst blankChecklist = (labels: string[]) =>\n labels.map((text) => ({ checked: false, text }));\n\nconst createIntakeStyles = (t: PdfcnTheme) =>\n StyleSheet.create({\n column: { flex: 1 },\n consentText: {\n fontSize: t.primitives.typography.xs,\n lineHeight: 1.4,\n marginBottom: 6,\n },\n labelText: { fontSize: 9, fontWeight: \"bold\", letterSpacing: 0.6 },\n page: { backgroundColor: t.colors.background },\n pageTwoHeader: {\n alignItems: \"flex-end\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n },\n reasonBox: {\n borderColor: t.colors.border,\n borderRadius: t.primitives.borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: 1,\n height: 40,\n minHeight: 40,\n },\n row: { flexDirection: \"row\", gap: 20 },\n section: { marginBottom: 4 },\n sectionRule: {\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n marginBottom: 4,\n paddingBottom: 2,\n },\n signature: { marginBottom: 0, marginTop: 8 },\n title: { fontSize: 13, fontWeight: \"bold\" },\n });\n\nconst useIntakeStyles = () => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createIntakeStyles(theme), [theme]);\n return { styles, theme };\n};\n\nconst SectionLabel = ({ accent, label }: { accent: string; label: string }) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={{ ...styles.sectionRule, borderBottomColor: accent } as never}>\n <Text noMargin style={styles.labelText} transform=\"uppercase\">\n {label}\n </Text>\n </View>\n );\n};\n\nconst IntakeHeader = ({\n clinicAddress,\n clinicLogo,\n clinicName,\n clinicPhone,\n}: Pick<\n MedicalIntakeFormProps,\n \"clinicAddress\" | \"clinicLogo\" | \"clinicName\" | \"clinicPhone\"\n>) => (\n <PageHeader\n logo={\n clinicLogo ? (\n <PdfImage\n height={48}\n src={clinicLogo}\n style={{ margin: 0 }}\n width={48}\n />\n ) : undefined\n }\n marginBottom={16}\n rightSubText={clinicAddress}\n rightText={clinicPhone}\n subtitle=\"Patient Intake Form\"\n title={clinicName}\n variant=\"logo-left\"\n />\n);\n\nconst SecondPageHeader = ({\n clinicName,\n clinicPhone,\n}: Pick<MedicalIntakeFormProps, \"clinicName\" | \"clinicPhone\">) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.pageTwoHeader as never}>\n <Text noMargin style={styles.title}>\n {`${clinicName} — Patient Intake Form (continued)`}\n </Text>\n <Text color=\"mutedForeground\" noMargin variant=\"xs\">\n {clinicPhone}\n </Text>\n </View>\n );\n};\n\nconst IntakeFooter = ({\n clinicAddress,\n clinicPhone,\n page,\n pagePadding,\n totalPages,\n}: Pick<MedicalIntakeFormProps, \"clinicAddress\" | \"clinicPhone\"> & {\n page: number;\n pagePadding: number;\n totalPages: number;\n}) => (\n <PageFooter\n address={clinicAddress}\n leftText={FORM_VERSION}\n pagePadding={pagePadding}\n phone={clinicPhone}\n rightText={`Page ${page} of ${totalPages}`}\n sticky\n variant=\"three-column\"\n />\n);\n\nconst PersonalInfoSection = () => (\n <PdfForm\n groups={[\n {\n fields: [\n { height: 14, label: \"Full Name\" },\n { height: 14, hint: \"DD / MM / YYYY\", label: \"Date of Birth\" },\n { height: 14, label: \"Gender\" },\n { height: 14, hint: \"+1 (555) 000-0000\", label: \"Phone Number\" },\n { height: 14, label: \"Email Address\" },\n ],\n layout: \"two-column\",\n title: \"Patient Information\",\n },\n {\n fields: [\n { height: 14, label: \"Street Address\", width: \"100%\" },\n { height: 14, label: \"City\" },\n { height: 14, label: \"State / Province\" },\n { height: 14, label: \"Postal Code\" },\n ],\n layout: \"two-column\",\n title: \"Address\",\n },\n ]}\n style={FORM_STYLE}\n variant=\"underline\"\n />\n);\n\nconst EmergencyContactSection = () => (\n <PdfForm\n groups={[\n {\n fields: [\n { height: 14, label: \"Emergency Contact Name\" },\n { height: 14, label: \"Relationship\" },\n { height: 14, label: \"Phone Number\" },\n ],\n layout: \"two-column\",\n title: \"Emergency Contact\",\n },\n ]}\n style={FORM_STYLE}\n variant=\"underline\"\n />\n);\n\nconst InsuranceSection = () => (\n <PdfForm\n groups={[\n {\n fields: [\n { height: 14, label: \"Insurance Provider\" },\n { height: 14, label: \"Policy Number\" },\n { height: 14, label: \"Group Number\" },\n { height: 14, label: \"Subscriber Name\" },\n ],\n layout: \"two-column\",\n title: \"Insurance\",\n },\n ]}\n style={FORM_STYLE}\n variant=\"underline\"\n />\n);\n\nconst MedicalHistorySection = ({ accent }: { accent: string }) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.section as never}>\n <SectionLabel accent={accent} label=\"Medical History\" />\n <View style={styles.row as never}>\n <View style={styles.column as never}>\n <PdfList\n gap=\"xs\"\n items={blankChecklist(MEDICAL_CONDITIONS.slice(0, 4))}\n variant=\"checklist\"\n />\n </View>\n <View style={styles.column as never}>\n <PdfList\n gap=\"xs\"\n items={blankChecklist(MEDICAL_CONDITIONS.slice(4, 8))}\n variant=\"checklist\"\n />\n </View>\n <View style={styles.column as never}>\n <PdfList\n gap=\"xs\"\n items={blankChecklist(MEDICAL_CONDITIONS.slice(8))}\n variant=\"checklist\"\n />\n </View>\n </View>\n </View>\n );\n};\n\nconst MedicationsSection = ({ accent }: { accent: string }) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.section as never}>\n <SectionLabel accent={accent} label=\"Current Medications\" />\n <Table variant=\"grid\">\n <TableHeader>\n <TableRow header>\n <TableCell>Medication</TableCell>\n <TableCell>Dosage</TableCell>\n <TableCell>Frequency</TableCell>\n <TableCell>Prescribing Doctor</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {MEDICATION_ROWS.map((row) => (\n <TableRow key={row}>\n <TableCell>{BLANK_CELL}</TableCell>\n <TableCell>{BLANK_CELL}</TableCell>\n <TableCell>{BLANK_CELL}</TableCell>\n <TableCell>{BLANK_CELL}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </View>\n );\n};\n\nconst AllergiesSection = ({ accent }: { accent: string }) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.section as never}>\n <SectionLabel accent={accent} label=\"Allergies\" />\n <Table variant=\"grid\">\n <TableHeader>\n <TableRow header>\n <TableCell>Allergen</TableCell>\n <TableCell>Reaction</TableCell>\n <TableCell>Severity</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {ALLERGY_ROWS.map((row) => (\n <TableRow key={row}>\n <TableCell>{BLANK_CELL}</TableCell>\n <TableCell>{BLANK_CELL}</TableCell>\n <TableCell>{BLANK_CELL}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </View>\n );\n};\n\nconst ReasonForVisitSection = ({ accent }: { accent: string }) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.section as never}>\n <SectionLabel accent={accent} label=\"Reason for Visit\" />\n <View style={styles.reasonBox as never} />\n </View>\n );\n};\n\nconst ConsentSection = ({\n accent,\n accentColor,\n clinicName,\n}: Pick<MedicalIntakeFormProps, \"accentColor\" | \"clinicName\"> & {\n accent: string;\n}) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.section as never}>\n <SectionLabel accent={accent} label=\"Consent & Authorization\" />\n <Section\n accentColor={accentColor}\n padding=\"sm\"\n spacing=\"none\"\n variant=\"highlight\"\n >\n <Text color=\"mutedForeground\" noMargin style={styles.consentText}>\n {`I authorize ${clinicName} to provide treatment and to release the information required to process insurance claims for this visit, and I acknowledge that I have received the Notice of Privacy Practices (HIPAA) explaining how my health information may be used.`}\n </Text>\n <PdfList gap=\"xs\" items={CONSENT_ACKNOWLEDGMENTS} variant=\"checklist\" />\n </Section>\n <PdfSignatureBlock\n signers={[{ label: \"Patient / Guardian Signature\" }, { label: \"Date\" }]}\n style={styles.signature}\n variant=\"double\"\n />\n </View>\n );\n};\n\ntype IntakeSections = Required<\n Pick<\n MedicalIntakeFormProps,\n | \"allergies\"\n | \"consent\"\n | \"emergencyContact\"\n | \"insurance\"\n | \"medicalHistory\"\n | \"medications\"\n | \"personalInfo\"\n | \"reasonForVisit\"\n >\n>;\n\nconst resolveSections = (props: MedicalIntakeFormProps): IntakeSections => ({\n allergies: props.allergies ?? true,\n consent: props.consent ?? true,\n emergencyContact: props.emergencyContact ?? true,\n insurance: props.insurance ?? true,\n medicalHistory: props.medicalHistory ?? true,\n medications: props.medications ?? true,\n personalInfo: props.personalInfo ?? true,\n reasonForVisit: props.reasonForVisit ?? true,\n});\n\nconst hasSecondPage = (sections: IntakeSections) =>\n sections.allergies ||\n sections.consent ||\n sections.medications ||\n sections.reasonForVisit;\n\nconst FirstPage = ({\n clinicAddress,\n clinicLogo,\n clinicName,\n clinicPhone,\n sections,\n totalPages,\n}: Pick<\n MedicalIntakeFormProps,\n \"clinicAddress\" | \"clinicLogo\" | \"clinicName\" | \"clinicPhone\"\n> & {\n sections: IntakeSections;\n totalPages: number;\n}) => {\n const { styles, theme } = useIntakeStyles();\n const margin = {\n bottom: theme.spacing.page.marginBottom,\n left: theme.spacing.page.marginLeft,\n right: theme.spacing.page.marginRight,\n top: theme.spacing.page.marginTop,\n };\n\n return (\n <Page margin={margin} size=\"A4\">\n <IntakeFooter\n clinicAddress={clinicAddress}\n clinicPhone={clinicPhone}\n page={1}\n pagePadding={margin.bottom}\n totalPages={totalPages}\n />\n <View style={styles.page as never}>\n <IntakeHeader\n clinicAddress={clinicAddress}\n clinicLogo={clinicLogo}\n clinicName={clinicName}\n clinicPhone={clinicPhone}\n />\n {sections.personalInfo ? <PersonalInfoSection /> : null}\n {sections.emergencyContact ? <EmergencyContactSection /> : null}\n {sections.insurance ? <InsuranceSection /> : null}\n </View>\n </Page>\n );\n};\n\nconst SecondPage = ({\n accent,\n accentColor,\n clinicAddress,\n clinicName,\n clinicPhone,\n sections,\n totalPages,\n}: Pick<\n MedicalIntakeFormProps,\n \"accentColor\" | \"clinicAddress\" | \"clinicName\" | \"clinicPhone\"\n> & {\n accent: string;\n sections: IntakeSections;\n totalPages: number;\n}) => {\n const { styles, theme } = useIntakeStyles();\n const margin = {\n bottom: SECOND_PAGE_MARGIN_BOTTOM,\n left: theme.spacing.page.marginLeft,\n right: theme.spacing.page.marginRight,\n top: SECOND_PAGE_MARGIN_TOP,\n };\n\n return (\n <Page margin={margin} size=\"A4\">\n <IntakeFooter\n clinicAddress={clinicAddress}\n clinicPhone={clinicPhone}\n page={2}\n pagePadding={margin.bottom}\n totalPages={totalPages}\n />\n <View style={styles.page as never}>\n <SecondPageHeader clinicName={clinicName} clinicPhone={clinicPhone} />\n {sections.medicalHistory ? (\n <MedicalHistorySection accent={accent} />\n ) : null}\n {sections.medications ? <MedicationsSection accent={accent} /> : null}\n {sections.allergies ? <AllergiesSection accent={accent} /> : null}\n {sections.reasonForVisit ? (\n <ReasonForVisitSection accent={accent} />\n ) : null}\n {sections.consent ? (\n <ConsentSection\n accent={accent}\n accentColor={accentColor}\n clinicName={clinicName}\n />\n ) : null}\n </View>\n </Page>\n );\n};\n\nconst MedicalIntakeFormContent = (props: MedicalIntakeFormProps) => {\n const { theme } = useIntakeStyles();\n const sections = resolveSections(props);\n const accent = props.accentColor\n ? resolveColor(props.accentColor, theme.colors)\n : theme.colors.primary;\n const totalPages = hasSecondPage(sections) ? 2 : 1;\n\n return (\n <Document title={`${props.clinicName} — Patient Intake Form`}>\n <FirstPage\n clinicAddress={props.clinicAddress}\n clinicLogo={props.clinicLogo}\n clinicName={props.clinicName}\n clinicPhone={props.clinicPhone}\n sections={sections}\n totalPages={totalPages}\n />\n {totalPages > 1 ? (\n <SecondPage\n accent={accent}\n accentColor={props.accentColor}\n clinicAddress={props.clinicAddress}\n clinicName={props.clinicName}\n clinicPhone={props.clinicPhone}\n sections={sections}\n totalPages={totalPages}\n />\n ) : null}\n </Document>\n );\n};\n\n/**\n * Print-ready medical intake form with patient, emergency contact, insurance,\n * medical history, medication, allergy, reason for visit, and consent\n * sections. Every section can be hidden through its boolean prop, and all\n * fields are left blank for the patient to complete by hand.\n */\nexport const MedicalIntakeFormDocument = ({\n theme,\n ...props\n}: MedicalIntakeFormProps) => (\n <PdfcnThemeProvider theme={theme}>\n <MedicalIntakeFormContent {...props} />\n </PdfcnThemeProvider>\n);\n",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { PdfForm } from \"@/components/pdf/form/form\";\nimport { PdfList } from \"@/components/pdf/list/list\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { PdfImage } from \"@/components/pdf/pdf-image/pdf-image\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport { PdfSignatureBlock } from \"@/components/pdf/signature/signature\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { MedicalIntakeFormProps } from \"./medical-intake-form.types\";\n\nconst FORM_VERSION = \"Form v1.0 · Revised 09/2026\";\nconst FORM_STYLE = { marginBottom: 0 };\n\nconst SECOND_PAGE_MARGIN_BOTTOM = 44;\nconst SECOND_PAGE_MARGIN_TOP = 24;\n\nconst MEDICAL_CONDITIONS = [\n \"Diabetes\",\n \"High Blood Pressure\",\n \"Heart Disease\",\n \"Asthma\",\n \"COPD\",\n \"Cancer\",\n \"Stroke\",\n \"Thyroid Disorder\",\n \"Kidney Disease\",\n \"Liver Disease\",\n \"Seizures / Epilepsy\",\n \"Other\",\n];\n\nconst CONSENT_ACKNOWLEDGMENTS = [\n { checked: false, text: \"I have read and understand the consent above.\" },\n { checked: false, text: \"I have received the Notice of Privacy Practices.\" },\n];\n\nconst MEDICATION_ROWS = [\n \"medication-1\",\n \"medication-2\",\n \"medication-3\",\n \"medication-4\",\n];\n\nconst ALLERGY_ROWS = [\"allergy-1\", \"allergy-2\", \"allergy-3\"];\n\nconst BLANK_CELL = <View style={{ minHeight: 14 }} />;\n\nconst blankChecklist = (labels: string[]) =>\n labels.map((text) => ({ checked: false, text }));\n\nconst createIntakeStyles = (t: PdfcnTheme) =>\n StyleSheet.create({\n column: { flex: 1 },\n consentText: {\n fontSize: t.primitives.typography.xs,\n lineHeight: 1.4,\n marginBottom: 6,\n },\n labelText: { fontSize: 9, fontWeight: \"bold\", letterSpacing: 0.6 },\n page: { backgroundColor: t.colors.background },\n pageTwoHeader: {\n alignItems: \"flex-end\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n },\n reasonBox: {\n borderColor: t.colors.border,\n borderRadius: t.primitives.borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: 1,\n height: 40,\n minHeight: 40,\n },\n row: { flexDirection: \"row\", gap: 20 },\n section: { marginBottom: 4 },\n sectionRule: {\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n marginBottom: 4,\n paddingBottom: 2,\n },\n signature: { marginBottom: 0, marginTop: 8 },\n title: { fontSize: 13, fontWeight: \"bold\" },\n });\n\nconst useIntakeStyles = () => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createIntakeStyles(theme), [theme]);\n return { styles, theme };\n};\n\nconst SectionLabel = ({ accent, label }: { accent: string; label: string }) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={{ ...styles.sectionRule, borderBottomColor: accent } as never}>\n <Text noMargin style={styles.labelText} transform=\"uppercase\">\n {label}\n </Text>\n </View>\n );\n};\n\nconst IntakeHeader = ({\n clinicAddress,\n clinicLogo,\n clinicName,\n clinicPhone,\n}: Pick<\n MedicalIntakeFormProps,\n \"clinicAddress\" | \"clinicLogo\" | \"clinicName\" | \"clinicPhone\"\n>) => (\n <PageHeader\n logo={\n clinicLogo ? (\n <PdfImage\n height={48}\n src={clinicLogo}\n style={{ margin: 0 }}\n width={48}\n />\n ) : undefined\n }\n marginBottom={16}\n rightSubText={clinicAddress}\n rightText={clinicPhone}\n subtitle=\"Patient Intake Form\"\n title={clinicName}\n variant=\"logo-left\"\n />\n);\n\nconst SecondPageHeader = ({\n clinicName,\n clinicPhone,\n}: Pick<MedicalIntakeFormProps, \"clinicName\" | \"clinicPhone\">) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.pageTwoHeader as never}>\n <Text noMargin style={styles.title}>\n {`${clinicName} — Patient Intake Form (continued)`}\n </Text>\n <Text color=\"mutedForeground\" noMargin variant=\"xs\">\n {clinicPhone}\n </Text>\n </View>\n );\n};\n\nconst IntakeFooter = ({\n clinicAddress,\n clinicPhone,\n page,\n pagePadding,\n totalPages,\n}: Pick<MedicalIntakeFormProps, \"clinicAddress\" | \"clinicPhone\"> & {\n page: number;\n pagePadding: number;\n totalPages: number;\n}) => (\n <PageFooter\n address={clinicAddress}\n leftText={FORM_VERSION}\n pagePadding={pagePadding}\n phone={clinicPhone}\n rightText={`Page ${page} of ${totalPages}`}\n sticky\n variant=\"three-column\"\n />\n);\n\nconst PersonalInfoSection = () => (\n <PdfForm\n groups={[\n {\n fields: [\n { height: 14, label: \"Full Name\" },\n { height: 14, hint: \"DD / MM / YYYY\", label: \"Date of Birth\" },\n { height: 14, label: \"Gender\" },\n { height: 14, hint: \"+1 (555) 000-0000\", label: \"Phone Number\" },\n { height: 14, label: \"Email Address\" },\n ],\n layout: \"two-column\",\n title: \"Patient Information\",\n },\n {\n fields: [\n { height: 14, label: \"Street Address\", width: \"100%\" },\n { height: 14, label: \"City\" },\n { height: 14, label: \"State / Province\" },\n { height: 14, label: \"Postal Code\" },\n ],\n layout: \"two-column\",\n title: \"Address\",\n },\n ]}\n style={FORM_STYLE}\n variant=\"underline\"\n />\n);\n\nconst EmergencyContactSection = () => (\n <PdfForm\n groups={[\n {\n fields: [\n { height: 14, label: \"Emergency Contact Name\" },\n { height: 14, label: \"Relationship\" },\n { height: 14, label: \"Phone Number\" },\n ],\n layout: \"two-column\",\n title: \"Emergency Contact\",\n },\n ]}\n style={FORM_STYLE}\n variant=\"underline\"\n />\n);\n\nconst InsuranceSection = () => (\n <PdfForm\n groups={[\n {\n fields: [\n { height: 14, label: \"Insurance Provider\" },\n { height: 14, label: \"Policy Number\" },\n { height: 14, label: \"Group Number\" },\n { height: 14, label: \"Subscriber Name\" },\n ],\n layout: \"two-column\",\n title: \"Insurance\",\n },\n ]}\n style={FORM_STYLE}\n variant=\"underline\"\n />\n);\n\nconst MedicalHistorySection = ({ accent }: { accent: string }) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.section as never}>\n <SectionLabel accent={accent} label=\"Medical History\" />\n <View style={styles.row as never}>\n <View style={styles.column as never}>\n <PdfList\n gap=\"xs\"\n items={blankChecklist(MEDICAL_CONDITIONS.slice(0, 4))}\n variant=\"checklist\"\n />\n </View>\n <View style={styles.column as never}>\n <PdfList\n gap=\"xs\"\n items={blankChecklist(MEDICAL_CONDITIONS.slice(4, 8))}\n variant=\"checklist\"\n />\n </View>\n <View style={styles.column as never}>\n <PdfList\n gap=\"xs\"\n items={blankChecklist(MEDICAL_CONDITIONS.slice(8))}\n variant=\"checklist\"\n />\n </View>\n </View>\n </View>\n );\n};\n\nconst MedicationsSection = ({ accent }: { accent: string }) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.section as never}>\n <SectionLabel accent={accent} label=\"Current Medications\" />\n <Table variant=\"grid\">\n <TableHeader>\n <TableRow header>\n <TableCell>Medication</TableCell>\n <TableCell>Dosage</TableCell>\n <TableCell>Frequency</TableCell>\n <TableCell>Prescribing Doctor</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {MEDICATION_ROWS.map((row) => (\n <TableRow key={row}>\n <TableCell>{BLANK_CELL}</TableCell>\n <TableCell>{BLANK_CELL}</TableCell>\n <TableCell>{BLANK_CELL}</TableCell>\n <TableCell>{BLANK_CELL}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </View>\n );\n};\n\nconst AllergiesSection = ({ accent }: { accent: string }) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.section as never}>\n <SectionLabel accent={accent} label=\"Allergies\" />\n <Table variant=\"grid\">\n <TableHeader>\n <TableRow header>\n <TableCell>Allergen</TableCell>\n <TableCell>Reaction</TableCell>\n <TableCell>Severity</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {ALLERGY_ROWS.map((row) => (\n <TableRow key={row}>\n <TableCell>{BLANK_CELL}</TableCell>\n <TableCell>{BLANK_CELL}</TableCell>\n <TableCell>{BLANK_CELL}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </View>\n );\n};\n\nconst ReasonForVisitSection = ({ accent }: { accent: string }) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.section as never}>\n <SectionLabel accent={accent} label=\"Reason for Visit\" />\n <View style={styles.reasonBox as never} />\n </View>\n );\n};\n\nconst ConsentSection = ({\n accent,\n accentColor,\n clinicName,\n}: Pick<MedicalIntakeFormProps, \"accentColor\" | \"clinicName\"> & {\n accent: string;\n}) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.section as never}>\n <SectionLabel accent={accent} label=\"Consent & Authorization\" />\n <Section\n accentColor={accentColor}\n padding=\"sm\"\n spacing=\"none\"\n variant=\"highlight\"\n >\n <Text color=\"mutedForeground\" noMargin style={styles.consentText}>\n {`I authorize ${clinicName} to provide treatment and to release the information required to process insurance claims for this visit, and I acknowledge that I have received the Notice of Privacy Practices (HIPAA) explaining how my health information may be used.`}\n </Text>\n <PdfList gap=\"xs\" items={CONSENT_ACKNOWLEDGMENTS} variant=\"checklist\" />\n </Section>\n <PdfSignatureBlock\n signers={[{ label: \"Patient / Guardian Signature\" }, { label: \"Date\" }]}\n style={styles.signature}\n variant=\"double\"\n />\n </View>\n );\n};\n\ntype IntakeSections = Required<\n Pick<\n MedicalIntakeFormProps,\n | \"allergies\"\n | \"consent\"\n | \"emergencyContact\"\n | \"insurance\"\n | \"medicalHistory\"\n | \"medications\"\n | \"personalInfo\"\n | \"reasonForVisit\"\n >\n>;\n\nconst resolveSections = (props: MedicalIntakeFormProps): IntakeSections => ({\n allergies: props.allergies ?? true,\n consent: props.consent ?? true,\n emergencyContact: props.emergencyContact ?? true,\n insurance: props.insurance ?? true,\n medicalHistory: props.medicalHistory ?? true,\n medications: props.medications ?? true,\n personalInfo: props.personalInfo ?? true,\n reasonForVisit: props.reasonForVisit ?? true,\n});\n\nconst hasSecondPage = (sections: IntakeSections) =>\n sections.allergies ||\n sections.consent ||\n sections.medications ||\n sections.reasonForVisit;\n\nconst FirstPage = ({\n clinicAddress,\n clinicLogo,\n clinicName,\n clinicPhone,\n sections,\n totalPages,\n}: Pick<\n MedicalIntakeFormProps,\n \"clinicAddress\" | \"clinicLogo\" | \"clinicName\" | \"clinicPhone\"\n> & {\n sections: IntakeSections;\n totalPages: number;\n}) => {\n const { styles, theme } = useIntakeStyles();\n const margin = {\n bottom: theme.spacing.page.marginBottom,\n left: theme.spacing.page.marginLeft,\n right: theme.spacing.page.marginRight,\n top: theme.spacing.page.marginTop,\n };\n\n return (\n <Page margin={margin} size=\"A4\">\n <IntakeFooter\n clinicAddress={clinicAddress}\n clinicPhone={clinicPhone}\n page={1}\n pagePadding={margin.bottom}\n totalPages={totalPages}\n />\n <View style={styles.page as never}>\n <IntakeHeader\n clinicAddress={clinicAddress}\n clinicLogo={clinicLogo}\n clinicName={clinicName}\n clinicPhone={clinicPhone}\n />\n {sections.personalInfo ? <PersonalInfoSection /> : null}\n {sections.emergencyContact ? <EmergencyContactSection /> : null}\n {sections.insurance ? <InsuranceSection /> : null}\n </View>\n </Page>\n );\n};\n\nconst SecondPage = ({\n accent,\n accentColor,\n clinicAddress,\n clinicName,\n clinicPhone,\n sections,\n totalPages,\n}: Pick<\n MedicalIntakeFormProps,\n \"accentColor\" | \"clinicAddress\" | \"clinicName\" | \"clinicPhone\"\n> & {\n accent: string;\n sections: IntakeSections;\n totalPages: number;\n}) => {\n const { styles, theme } = useIntakeStyles();\n const margin = {\n bottom: SECOND_PAGE_MARGIN_BOTTOM,\n left: theme.spacing.page.marginLeft,\n right: theme.spacing.page.marginRight,\n top: SECOND_PAGE_MARGIN_TOP,\n };\n\n return (\n <Page margin={margin} size=\"A4\">\n <IntakeFooter\n clinicAddress={clinicAddress}\n clinicPhone={clinicPhone}\n page={2}\n pagePadding={margin.bottom}\n totalPages={totalPages}\n />\n <View style={styles.page as never}>\n <SecondPageHeader clinicName={clinicName} clinicPhone={clinicPhone} />\n {sections.medicalHistory ? (\n <MedicalHistorySection accent={accent} />\n ) : null}\n {sections.medications ? <MedicationsSection accent={accent} /> : null}\n {sections.allergies ? <AllergiesSection accent={accent} /> : null}\n {sections.reasonForVisit ? (\n <ReasonForVisitSection accent={accent} />\n ) : null}\n {sections.consent ? (\n <ConsentSection\n accent={accent}\n accentColor={accentColor}\n clinicName={clinicName}\n />\n ) : null}\n </View>\n </Page>\n );\n};\n\nconst MedicalIntakeFormContent = (props: MedicalIntakeFormProps) => {\n const { theme } = useIntakeStyles();\n const sections = resolveSections(props);\n const accent = props.accentColor\n ? resolveColor(props.accentColor, theme.colors)\n : theme.colors.primary;\n const totalPages = hasSecondPage(sections) ? 2 : 1;\n\n return (\n <Document title={`${props.clinicName} — Patient Intake Form`}>\n <FirstPage\n clinicAddress={props.clinicAddress}\n clinicLogo={props.clinicLogo}\n clinicName={props.clinicName}\n clinicPhone={props.clinicPhone}\n sections={sections}\n totalPages={totalPages}\n />\n {totalPages > 1 ? (\n <SecondPage\n accent={accent}\n accentColor={props.accentColor}\n clinicAddress={props.clinicAddress}\n clinicName={props.clinicName}\n clinicPhone={props.clinicPhone}\n sections={sections}\n totalPages={totalPages}\n />\n ) : null}\n </Document>\n );\n};\n\n/**\n * Print-ready medical intake form with patient, emergency contact, insurance,\n * medical history, medication, allergy, reason for visit, and consent\n * sections. Every section can be hidden through its boolean prop, and all\n * fields are left blank for the patient to complete by hand.\n */\nexport const MedicalIntakeFormDocument = ({\n theme,\n ...props\n}: MedicalIntakeFormProps) => (\n <PdfcnThemeProvider theme={theme}>\n <MedicalIntakeFormContent {...props} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/medical-intake-form/medical-intake-form.tsx"
},
{
"path": "registry/bases/forme/blocks/medical-intake-form/medical-intake-form.types.ts",
- "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\n/**\n * Medical intake form properties.\n * Props - `clinicName` | `clinicLogo` | `clinicAddress` | `clinicPhone` |\n * `personalInfo` | `emergencyContact` | `insurance` | `medicalHistory` |\n * `medications` | `allergies` | `reasonForVisit` | `consent` | `accentColor` | `theme`\n * @see {@link MedicalIntakeFormDocument}\n */\nexport interface MedicalIntakeFormProps {\n clinicName: string;\n clinicLogo?: string;\n clinicAddress?: string;\n clinicPhone?: string;\n /**\n * @default true\n */\n personalInfo?: boolean;\n /**\n * @default true\n */\n emergencyContact?: boolean;\n /**\n * @default true\n */\n insurance?: boolean;\n /**\n * @default true\n */\n medicalHistory?: boolean;\n /**\n * @default true\n */\n medications?: boolean;\n /**\n * @default true\n */\n allergies?: boolean;\n /**\n * @default true\n */\n reasonForVisit?: boolean;\n /**\n * @default true\n */\n consent?: boolean;\n /**\n * Theme color token (e.g. `\"primary\"`) or raw CSS color (e.g. `\"#0d9488\"`)\n * applied to section rules, table accents, and the consent callout.\n */\n accentColor?: string;\n theme?: PdfcnTheme;\n}\n",
+ "content": "import type { PdfcnTheme } from \"@/types/pdf-themes\";\n\n/**\n * Medical intake form properties.\n * Props - `clinicName` | `clinicLogo` | `clinicAddress` | `clinicPhone` |\n * `personalInfo` | `emergencyContact` | `insurance` | `medicalHistory` |\n * `medications` | `allergies` | `reasonForVisit` | `consent` | `accentColor` | `theme`\n * @see {@link MedicalIntakeFormDocument}\n */\nexport interface MedicalIntakeFormProps {\n clinicName: string;\n clinicLogo?: string;\n clinicAddress?: string;\n clinicPhone?: string;\n /**\n * @default true\n */\n personalInfo?: boolean;\n /**\n * @default true\n */\n emergencyContact?: boolean;\n /**\n * @default true\n */\n insurance?: boolean;\n /**\n * @default true\n */\n medicalHistory?: boolean;\n /**\n * @default true\n */\n medications?: boolean;\n /**\n * @default true\n */\n allergies?: boolean;\n /**\n * @default true\n */\n reasonForVisit?: boolean;\n /**\n * @default true\n */\n consent?: boolean;\n /**\n * Theme color token (e.g. `\"primary\"`) or raw CSS color (e.g. `\"#0d9488\"`)\n * applied to section rules, table accents, and the consent callout.\n */\n accentColor?: string;\n theme?: PdfcnTheme;\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/medical-intake-form/medical-intake-form.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/meeting-minutes.json b/apps/web/public/r/forme/meeting-minutes.json
index 614baba..b5e392c 100644
--- a/apps/web/public/r/forme/meeting-minutes.json
+++ b/apps/web/public/r/forme/meeting-minutes.json
@@ -20,7 +20,7 @@
"files": [
{
"path": "registry/bases/forme/blocks/meeting-minutes/meeting-minutes.tsx",
- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { Badge } from \"@/registry/bases/forme/components/badge/badge\";\nimport { PdfList } from \"@/registry/bases/forme/components/list/list\";\nimport { PageFooter } from \"@/registry/bases/forme/components/page-footer/page-footer\";\nimport { PageHeader } from \"@/registry/bases/forme/components/page-header/page-header\";\nimport { Section } from \"@/registry/bases/forme/components/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/registry/bases/forme/components/table/table\";\nimport { Text } from \"@/registry/bases/forme/components/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type {\n MeetingMinutesActionStatus,\n MeetingMinutesProps,\n} from \"./meeting-minutes.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: MeetingMinutesProps = {\n absent: [{ name: \"Casey Wu\", role: \"QA Lead\" }],\n accentColor: \"#0891b2\",\n actionItems: [\n {\n dueDate: \"Sep 19, 2026\",\n owner: \"Jordan Lee\",\n status: \"In Progress\",\n task: \"Create pdfme integration RFC\",\n },\n {\n dueDate: \"Sep 22, 2026\",\n owner: \"Sam Patel\",\n status: \"Not Started\",\n task: \"Design community page wireframes\",\n },\n {\n dueDate: \"Sep 26, 2026\",\n owner: \"Alex Kim\",\n status: \"Complete\",\n task: \"Share Q2 outcomes deck with stakeholders\",\n },\n ],\n agenda: [\n \"Review Q2 outcomes\",\n \"Q3 feature priorities\",\n \"Resource allocation\",\n \"Timeline and milestones\",\n ],\n attendees: [\n { name: \"Alex Kim\", role: \"Product Lead\" },\n { name: \"Jordan Lee\", role: \"Engineering Lead\" },\n { name: \"Sam Patel\", role: \"Design Lead\" },\n ],\n date: \"September 12, 2026\",\n decisions: [\n {\n decision: \"Proceed with pdfme as second rendering base\",\n number: 1,\n rationale: \"Better JSX support\",\n },\n {\n decision: \"Allocate 2 engineers to PDF module full-time\",\n number: 2,\n },\n ],\n discussions: [\n {\n notes: [\n \"Shipped 4 of 5 planned features\",\n \"Customer satisfaction up 12%\",\n ],\n speaker: \"Alex Kim\",\n topic: \"Q2 Outcomes\",\n },\n {\n notes: [\n \"PDF generation module is top priority\",\n \"Community page scheduled for late Q3\",\n ],\n speaker: \"Jordan Lee\",\n topic: \"Q3 Feature Priorities\",\n },\n ],\n distributionList: [\"[email protected]\", \"[email protected]\"],\n guests: [\"Riya Shah (Advisor)\"],\n location: \"Conference Room B / Zoom\",\n meetingTitle: \"Q3 Product Roadmap Review\",\n nextMeeting: {\n agenda: [\"Review action items\", \"pdfme RFC walkthrough\"],\n date: \"September 19, 2026\",\n time: \"2:00 PM\",\n },\n organizer: \"Alex Kim\",\n preparedBy: \"Alex Kim\",\n time: \"2:00 PM - 3:30 PM\",\n};\n\nconst STATUS_VARIANT: Record<\n MeetingMinutesActionStatus,\n \"success\" | \"info\" | \"default\"\n> = {\n Complete: \"success\",\n \"In Progress\": \"info\",\n \"Not Started\": \"default\",\n};\n\nconst formatAttendee = (a: { name: string; role?: string }) =>\n `${a.name}${a.role ? ` — ${a.role}` : \"\"}`;\n\nconst MeetingMinutesContent = ({ data }: { data: MeetingMinutesProps }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n columnHeading: {\n fontSize: 9,\n fontWeight: \"bold\",\n marginBottom: 2,\n },\n discussionTopic: {\n marginBottom: theme.primitives.spacing[2],\n },\n listItem: {\n marginBottom: theme.primitives.spacing[1],\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n });\n\n const attendeeColumns = [\n { heading: \"Attendees\", names: data.attendees.map(formatAttendee) },\n ...(data.absent?.length\n ? [{ heading: \"Absent\", names: data.absent.map(formatAttendee) }]\n : []),\n ...(data.guests?.length ? [{ heading: \"Guests\", names: data.guests }] : []),\n ];\n\n return (\n <Document title={`Minutes — ${data.meetingTitle}`}>\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\n <PageFooter\n leftText={`Prepared by ${data.preparedBy}`}\n rightText={\n data.distributionList?.length\n ? `Distribution: ${data.distributionList.join(\", \")}`\n : undefined\n }\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"simple\"\n title={data.meetingTitle}\n subtitle={`${data.location} · Organized by ${data.organizer}`}\n rightText={data.date}\n rightSubText={data.time}\n style={{ marginBottom: 0 }}\n />\n <Section spacing=\"sm\" style={{ flexDirection: \"row\" }}>\n {attendeeColumns.map((column) => (\n <View key={column.heading} style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n {column.heading}\n </Text>\n {column.names.map((name) => (\n <Text key={name} noMargin variant=\"xs\">\n {name}\n </Text>\n ))}\n </View>\n ))}\n </Section>\n <Section spacing=\"sm\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Agenda\n </Text>\n {data.agenda.map((item, index) => (\n <Text key={item} style={styles.listItem} variant=\"sm\" noMargin>\n {`${index + 1}. ${item}`}\n </Text>\n ))}\n </Section>\n <Section spacing=\"sm\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Discussion\n </Text>\n {data.discussions.map((discussion) => (\n <View key={discussion.topic} style={styles.discussionTopic}>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {discussion.topic}\n </Text>\n {discussion.speaker && (\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {`— ${discussion.speaker}`}\n </Text>\n )}\n <PdfList\n variant=\"bullet\"\n gap=\"xs\"\n items={discussion.notes.map((text) => ({ text }))}\n />\n </View>\n ))}\n </Section>\n </View>\n </Page>\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\n <PageFooter\n leftText={`Prepared by ${data.preparedBy}`}\n rightText={\n data.distributionList?.length\n ? `Distribution: ${data.distributionList.join(\", \")}`\n : undefined\n }\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <Section spacing=\"sm\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Decisions\n </Text>\n {data.decisions.map((d) => (\n <View key={d.number} style={styles.discussionTopic}>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {`${d.number}. ${d.decision}`}\n </Text>\n {d.rationale && (\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {d.rationale}\n </Text>\n )}\n </View>\n ))}\n </Section>\n <Section spacing=\"sm\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Action Items\n </Text>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Task</TableCell>\n <TableCell align=\"center\">Owner</TableCell>\n <TableCell align=\"center\">Due Date</TableCell>\n <TableCell align=\"center\">Status</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.actionItems.map((item) => (\n <TableRow key={item.task}>\n <TableCell>{item.task}</TableCell>\n <TableCell align=\"center\">{item.owner}</TableCell>\n <TableCell align=\"center\">{item.dueDate}</TableCell>\n <TableCell align=\"center\">\n <Badge\n variant={STATUS_VARIANT[item.status]}\n size=\"sm\"\n label={item.status}\n />\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </Section>\n {data.nextMeeting && (\n <Section\n spacing=\"sm\"\n variant=\"highlight\"\n accentColor={data.accentColor}\n >\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Next Meeting\n </Text>\n <Text variant=\"sm\" weight=\"medium\" noMargin>\n {`${data.nextMeeting.date} · ${data.nextMeeting.time}`}\n </Text>\n {data.nextMeeting.agenda && (\n <PdfList\n variant=\"bullet\"\n gap=\"xs\"\n items={data.nextMeeting.agenda.map((text) => ({ text }))}\n />\n )}\n </Section>\n )}\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const MeetingMinutesDocument = ({\n theme,\n data,\n ...props\n}: {\n theme?: PdfcnTheme;\n data?: MeetingMinutesProps;\n} & Partial<MeetingMinutesProps>) => (\n <PdfcnThemeProvider theme={theme}>\n <MeetingMinutesContent data={{ ...sampleData, ...data, ...props }} />\n </PdfcnThemeProvider>\n);\n",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { Badge } from \"@/components/pdf/badge/badge\";\nimport { PdfList } from \"@/components/pdf/list/list\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type {\n MeetingMinutesActionStatus,\n MeetingMinutesProps,\n} from \"./meeting-minutes.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: MeetingMinutesProps = {\n absent: [{ name: \"Casey Wu\", role: \"QA Lead\" }],\n accentColor: \"#0891b2\",\n actionItems: [\n {\n dueDate: \"Sep 19, 2026\",\n owner: \"Jordan Lee\",\n status: \"In Progress\",\n task: \"Create pdfme integration RFC\",\n },\n {\n dueDate: \"Sep 22, 2026\",\n owner: \"Sam Patel\",\n status: \"Not Started\",\n task: \"Design community page wireframes\",\n },\n {\n dueDate: \"Sep 26, 2026\",\n owner: \"Alex Kim\",\n status: \"Complete\",\n task: \"Share Q2 outcomes deck with stakeholders\",\n },\n ],\n agenda: [\n \"Review Q2 outcomes\",\n \"Q3 feature priorities\",\n \"Resource allocation\",\n \"Timeline and milestones\",\n ],\n attendees: [\n { name: \"Alex Kim\", role: \"Product Lead\" },\n { name: \"Jordan Lee\", role: \"Engineering Lead\" },\n { name: \"Sam Patel\", role: \"Design Lead\" },\n ],\n date: \"September 12, 2026\",\n decisions: [\n {\n decision: \"Proceed with pdfme as second rendering base\",\n number: 1,\n rationale: \"Better JSX support\",\n },\n {\n decision: \"Allocate 2 engineers to PDF module full-time\",\n number: 2,\n },\n ],\n discussions: [\n {\n notes: [\n \"Shipped 4 of 5 planned features\",\n \"Customer satisfaction up 12%\",\n ],\n speaker: \"Alex Kim\",\n topic: \"Q2 Outcomes\",\n },\n {\n notes: [\n \"PDF generation module is top priority\",\n \"Community page scheduled for late Q3\",\n ],\n speaker: \"Jordan Lee\",\n topic: \"Q3 Feature Priorities\",\n },\n ],\n distributionList: [\"[email protected]\", \"[email protected]\"],\n guests: [\"Riya Shah (Advisor)\"],\n location: \"Conference Room B / Zoom\",\n meetingTitle: \"Q3 Product Roadmap Review\",\n nextMeeting: {\n agenda: [\"Review action items\", \"pdfme RFC walkthrough\"],\n date: \"September 19, 2026\",\n time: \"2:00 PM\",\n },\n organizer: \"Alex Kim\",\n preparedBy: \"Alex Kim\",\n time: \"2:00 PM - 3:30 PM\",\n};\n\nconst STATUS_VARIANT: Record<\n MeetingMinutesActionStatus,\n \"success\" | \"info\" | \"default\"\n> = {\n Complete: \"success\",\n \"In Progress\": \"info\",\n \"Not Started\": \"default\",\n};\n\nconst formatAttendee = (a: { name: string; role?: string }) =>\n `${a.name}${a.role ? ` — ${a.role}` : \"\"}`;\n\nconst MeetingMinutesContent = ({ data }: { data: MeetingMinutesProps }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n columnHeading: {\n fontSize: 9,\n fontWeight: \"bold\",\n marginBottom: 2,\n },\n discussionTopic: {\n marginBottom: theme.primitives.spacing[2],\n },\n listItem: {\n marginBottom: theme.primitives.spacing[1],\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n });\n\n const attendeeColumns = [\n { heading: \"Attendees\", names: data.attendees.map(formatAttendee) },\n ...(data.absent?.length\n ? [{ heading: \"Absent\", names: data.absent.map(formatAttendee) }]\n : []),\n ...(data.guests?.length ? [{ heading: \"Guests\", names: data.guests }] : []),\n ];\n\n return (\n <Document title={`Minutes — ${data.meetingTitle}`}>\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\n <PageFooter\n leftText={`Prepared by ${data.preparedBy}`}\n rightText={\n data.distributionList?.length\n ? `Distribution: ${data.distributionList.join(\", \")}`\n : undefined\n }\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"simple\"\n title={data.meetingTitle}\n subtitle={`${data.location} · Organized by ${data.organizer}`}\n rightText={data.date}\n rightSubText={data.time}\n style={{ marginBottom: 0 }}\n />\n <Section spacing=\"sm\" style={{ flexDirection: \"row\" }}>\n {attendeeColumns.map((column) => (\n <View key={column.heading} style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n {column.heading}\n </Text>\n {column.names.map((name) => (\n <Text key={name} noMargin variant=\"xs\">\n {name}\n </Text>\n ))}\n </View>\n ))}\n </Section>\n <Section spacing=\"sm\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Agenda\n </Text>\n {data.agenda.map((item, index) => (\n <Text key={item} style={styles.listItem} variant=\"sm\" noMargin>\n {`${index + 1}. ${item}`}\n </Text>\n ))}\n </Section>\n <Section spacing=\"sm\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Discussion\n </Text>\n {data.discussions.map((discussion) => (\n <View key={discussion.topic} style={styles.discussionTopic}>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {discussion.topic}\n </Text>\n {discussion.speaker && (\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {`— ${discussion.speaker}`}\n </Text>\n )}\n <PdfList\n variant=\"bullet\"\n gap=\"xs\"\n items={discussion.notes.map((text) => ({ text }))}\n />\n </View>\n ))}\n </Section>\n </View>\n </Page>\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\n <PageFooter\n leftText={`Prepared by ${data.preparedBy}`}\n rightText={\n data.distributionList?.length\n ? `Distribution: ${data.distributionList.join(\", \")}`\n : undefined\n }\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <Section spacing=\"sm\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Decisions\n </Text>\n {data.decisions.map((d) => (\n <View key={d.number} style={styles.discussionTopic}>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {`${d.number}. ${d.decision}`}\n </Text>\n {d.rationale && (\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {d.rationale}\n </Text>\n )}\n </View>\n ))}\n </Section>\n <Section spacing=\"sm\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Action Items\n </Text>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Task</TableCell>\n <TableCell align=\"center\">Owner</TableCell>\n <TableCell align=\"center\">Due Date</TableCell>\n <TableCell align=\"center\">Status</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.actionItems.map((item) => (\n <TableRow key={item.task}>\n <TableCell>{item.task}</TableCell>\n <TableCell align=\"center\">{item.owner}</TableCell>\n <TableCell align=\"center\">{item.dueDate}</TableCell>\n <TableCell align=\"center\">\n <Badge\n variant={STATUS_VARIANT[item.status]}\n size=\"sm\"\n label={item.status}\n />\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </Section>\n {data.nextMeeting && (\n <Section\n spacing=\"sm\"\n variant=\"highlight\"\n accentColor={data.accentColor}\n >\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Next Meeting\n </Text>\n <Text variant=\"sm\" weight=\"medium\" noMargin>\n {`${data.nextMeeting.date} · ${data.nextMeeting.time}`}\n </Text>\n {data.nextMeeting.agenda && (\n <PdfList\n variant=\"bullet\"\n gap=\"xs\"\n items={data.nextMeeting.agenda.map((text) => ({ text }))}\n />\n )}\n </Section>\n )}\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const MeetingMinutesDocument = ({\n theme,\n data,\n ...props\n}: {\n theme?: PdfcnTheme;\n data?: MeetingMinutesProps;\n} & Partial<MeetingMinutesProps>) => (\n <PdfcnThemeProvider theme={theme}>\n <MeetingMinutesContent data={{ ...sampleData, ...data, ...props }} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/meeting-minutes/meeting-minutes.tsx"
},
@@ -32,4 +32,4 @@
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/packing-slip.json b/apps/web/public/r/forme/packing-slip.json
index 73a985e..72ee2a2 100644
--- a/apps/web/public/r/forme/packing-slip.json
+++ b/apps/web/public/r/forme/packing-slip.json
@@ -20,7 +20,7 @@
"files": [
{
"path": "registry/bases/forme/blocks/packing-slip/packing-slip.tsx",
- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { KeyValue } from \"@/registry/bases/forme/components/key-value/key-value\";\nimport { PageFooter } from \"@/registry/bases/forme/components/page-footer/page-footer\";\nimport { PageHeader } from \"@/registry/bases/forme/components/page-header/page-header\";\nimport { PdfImage } from \"@/registry/bases/forme/components/pdf-image/pdf-image\";\nimport { Section } from \"@/registry/bases/forme/components/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/registry/bases/forme/components/table/table\";\nimport { Text } from \"@/registry/bases/forme/components/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type { PackingSlipProps, PackingSlipSender } from \"./packing-slip.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: PackingSlipProps = {\n accentColor: \"#059669\",\n companyName: \"Acme Store\",\n customerService: \"[email protected]\",\n items: [\n {\n name: \"Widget Pro\",\n qtyOrdered: 2,\n qtyPacked: 2,\n sku: \"WP-001\",\n unitPrice: 49.99,\n },\n {\n name: \"Gadget Lite\",\n qtyOrdered: 1,\n qtyPacked: 1,\n sku: \"GL-010\",\n unitPrice: 29.99,\n },\n {\n name: \"Cable Kit\",\n qtyOrdered: 3,\n qtyPacked: 2,\n sku: \"CK-204\",\n unitPrice: 9.5,\n },\n ],\n orderDate: \"Sep 10, 2026\",\n orderNumber: \"ORD-2026-0891\",\n poNumber: \"PO-4471\",\n returnsPolicy: \"Returns accepted within 30 days with original packaging.\",\n shipFrom: {\n address: \"100 Industrial Blvd\",\n city: \"Seattle\",\n name: \"Acme Warehouse\",\n state: \"WA\",\n zip: \"98101\",\n },\n shipTo: {\n address: \"456 Oak Ave\",\n city: \"Portland\",\n name: \"Jane Doe\",\n phone: \"(503) 555-0142\",\n state: \"OR\",\n zip: \"97201\",\n },\n shipping: {\n carrier: \"UPS\",\n estimatedDelivery: \"Sep 15, 2026\",\n method: \"Ground\",\n trackingNumber: \"1Z999AA10123456784\",\n },\n thankYouMessage: \"Thank you for your order!\",\n totalPackages: 1,\n totalWeight: \"3.2 kg\",\n};\n\nconst formatAddress = (a: PackingSlipSender & { country?: string }) =>\n `${a.address}, ${a.city}, ${a.state} ${a.zip}${a.country ? `, ${a.country}` : \"\"}`;\n\nconst PackingSlipContent = ({ data }: { data: PackingSlipProps }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n columnHeading: {\n fontSize: 9,\n fontWeight: \"bold\",\n marginBottom: 2,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n });\n\n const totalPacked = data.items.reduce((sum, item) => sum + item.qtyPacked, 0);\n const totalOrdered = data.items.reduce(\n (sum, item) => sum + item.qtyOrdered,\n 0\n );\n\n const summaryItems = [\n { key: \"Items Packed\", value: `${totalPacked} of ${totalOrdered}` },\n ...(data.totalPackages === undefined\n ? []\n : [{ key: \"Packages\", value: `${data.totalPackages}` }]),\n ...(data.totalWeight\n ? [{ key: \"Total Weight\", value: data.totalWeight }]\n : []),\n ];\n\n return (\n <Document title={`Packing Slip ${data.orderNumber}`}>\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\n <PageFooter\n leftText={data.customerService ?? data.companyName}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"logo-left\"\n logo={\n data.companyLogo ? (\n <PdfImage src={data.companyLogo} style={{ margin: 0 }} />\n ) : undefined\n }\n title=\"PACKING SLIP\"\n subtitle={data.companyName}\n rightText={data.orderNumber}\n rightSubText={`Order Date: ${data.orderDate}`}\n style={{ marginBottom: 0 }}\n />\n <Section noWrap style={{ flexDirection: \"row\" }}>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Ship To\n </Text>\n <Text noMargin variant=\"xs\">\n {data.shipTo.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {formatAddress(data.shipTo)}\n </Text>\n {data.shipTo.phone && (\n <Text noMargin variant=\"xs\">\n {data.shipTo.phone}\n </Text>\n )}\n </View>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n From\n </Text>\n <Text noMargin variant=\"xs\">\n {data.shipFrom.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {formatAddress(data.shipFrom)}\n </Text>\n </View>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Order\n </Text>\n <Text noMargin variant=\"xs\">\n {data.orderNumber}\n </Text>\n {data.poNumber && (\n <Text noMargin variant=\"xs\">\n {`PO: ${data.poNumber}`}\n </Text>\n )}\n </View>\n </Section>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Item</TableCell>\n <TableCell align=\"center\">SKU</TableCell>\n <TableCell align=\"center\">Packed</TableCell>\n <TableCell align=\"center\">Ordered</TableCell>\n <TableCell align=\"right\">Unit Price</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item) => (\n <TableRow key={item.sku}>\n <TableCell>{item.name}</TableCell>\n <TableCell align=\"center\">{item.sku}</TableCell>\n <TableCell align=\"center\">{`${item.qtyPacked}`}</TableCell>\n <TableCell align=\"center\">{`${item.qtyOrdered}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toFixed(2)}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.qtyPacked * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 16 }}>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Shipping\n </Text>\n <Text noMargin variant=\"xs\">\n {`${data.shipping.carrier} — ${data.shipping.method}`}\n </Text>\n <Text noMargin variant=\"xs\">\n {`Tracking: ${data.shipping.trackingNumber}`}\n </Text>\n {data.shipping.estimatedDelivery && (\n <Text noMargin variant=\"xs\">\n {`Est. Delivery: ${data.shipping.estimatedDelivery}`}\n </Text>\n )}\n </View>\n <View style={{ marginLeft: \"auto\", width: 220 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={summaryItems}\n divided\n />\n </View>\n </Section>\n {(data.thankYouMessage || data.returnsPolicy) && (\n <Section\n spacing=\"sm\"\n variant=\"highlight\"\n accentColor={data.accentColor}\n >\n {data.thankYouMessage && (\n <Text variant=\"sm\" weight=\"medium\" noMargin>\n {data.thankYouMessage}\n </Text>\n )}\n {data.returnsPolicy && (\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {data.returnsPolicy}\n </Text>\n )}\n </Section>\n )}\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const PackingSlipDocument = ({\n theme,\n data,\n ...props\n}: {\n theme?: PdfcnTheme;\n data?: PackingSlipProps;\n} & Partial<PackingSlipProps>) => (\n <PdfcnThemeProvider theme={theme}>\n <PackingSlipContent data={{ ...sampleData, ...data, ...props }} />\n </PdfcnThemeProvider>\n);\n",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { PdfImage } from \"@/components/pdf/pdf-image/pdf-image\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { PackingSlipProps, PackingSlipSender } from \"./packing-slip.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: PackingSlipProps = {\n accentColor: \"#059669\",\n companyName: \"Acme Store\",\n customerService: \"[email protected]\",\n items: [\n {\n name: \"Widget Pro\",\n qtyOrdered: 2,\n qtyPacked: 2,\n sku: \"WP-001\",\n unitPrice: 49.99,\n },\n {\n name: \"Gadget Lite\",\n qtyOrdered: 1,\n qtyPacked: 1,\n sku: \"GL-010\",\n unitPrice: 29.99,\n },\n {\n name: \"Cable Kit\",\n qtyOrdered: 3,\n qtyPacked: 2,\n sku: \"CK-204\",\n unitPrice: 9.5,\n },\n ],\n orderDate: \"Sep 10, 2026\",\n orderNumber: \"ORD-2026-0891\",\n poNumber: \"PO-4471\",\n returnsPolicy: \"Returns accepted within 30 days with original packaging.\",\n shipFrom: {\n address: \"100 Industrial Blvd\",\n city: \"Seattle\",\n name: \"Acme Warehouse\",\n state: \"WA\",\n zip: \"98101\",\n },\n shipTo: {\n address: \"456 Oak Ave\",\n city: \"Portland\",\n name: \"Jane Doe\",\n phone: \"(503) 555-0142\",\n state: \"OR\",\n zip: \"97201\",\n },\n shipping: {\n carrier: \"UPS\",\n estimatedDelivery: \"Sep 15, 2026\",\n method: \"Ground\",\n trackingNumber: \"1Z999AA10123456784\",\n },\n thankYouMessage: \"Thank you for your order!\",\n totalPackages: 1,\n totalWeight: \"3.2 kg\",\n};\n\nconst formatAddress = (a: PackingSlipSender & { country?: string }) =>\n `${a.address}, ${a.city}, ${a.state} ${a.zip}${a.country ? `, ${a.country}` : \"\"}`;\n\nconst PackingSlipContent = ({ data }: { data: PackingSlipProps }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n columnHeading: {\n fontSize: 9,\n fontWeight: \"bold\",\n marginBottom: 2,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n });\n\n const totalPacked = data.items.reduce((sum, item) => sum + item.qtyPacked, 0);\n const totalOrdered = data.items.reduce(\n (sum, item) => sum + item.qtyOrdered,\n 0\n );\n\n const summaryItems = [\n { key: \"Items Packed\", value: `${totalPacked} of ${totalOrdered}` },\n ...(data.totalPackages === undefined\n ? []\n : [{ key: \"Packages\", value: `${data.totalPackages}` }]),\n ...(data.totalWeight\n ? [{ key: \"Total Weight\", value: data.totalWeight }]\n : []),\n ];\n\n return (\n <Document title={`Packing Slip ${data.orderNumber}`}>\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\n <PageFooter\n leftText={data.customerService ?? data.companyName}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"logo-left\"\n logo={\n data.companyLogo ? (\n <PdfImage src={data.companyLogo} style={{ margin: 0 }} />\n ) : undefined\n }\n title=\"PACKING SLIP\"\n subtitle={data.companyName}\n rightText={data.orderNumber}\n rightSubText={`Order Date: ${data.orderDate}`}\n style={{ marginBottom: 0 }}\n />\n <Section noWrap style={{ flexDirection: \"row\" }}>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Ship To\n </Text>\n <Text noMargin variant=\"xs\">\n {data.shipTo.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {formatAddress(data.shipTo)}\n </Text>\n {data.shipTo.phone && (\n <Text noMargin variant=\"xs\">\n {data.shipTo.phone}\n </Text>\n )}\n </View>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n From\n </Text>\n <Text noMargin variant=\"xs\">\n {data.shipFrom.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {formatAddress(data.shipFrom)}\n </Text>\n </View>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Order\n </Text>\n <Text noMargin variant=\"xs\">\n {data.orderNumber}\n </Text>\n {data.poNumber && (\n <Text noMargin variant=\"xs\">\n {`PO: ${data.poNumber}`}\n </Text>\n )}\n </View>\n </Section>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Item</TableCell>\n <TableCell align=\"center\">SKU</TableCell>\n <TableCell align=\"center\">Packed</TableCell>\n <TableCell align=\"center\">Ordered</TableCell>\n <TableCell align=\"right\">Unit Price</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item) => (\n <TableRow key={item.sku}>\n <TableCell>{item.name}</TableCell>\n <TableCell align=\"center\">{item.sku}</TableCell>\n <TableCell align=\"center\">{`${item.qtyPacked}`}</TableCell>\n <TableCell align=\"center\">{`${item.qtyOrdered}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toFixed(2)}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.qtyPacked * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 16 }}>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Shipping\n </Text>\n <Text noMargin variant=\"xs\">\n {`${data.shipping.carrier} — ${data.shipping.method}`}\n </Text>\n <Text noMargin variant=\"xs\">\n {`Tracking: ${data.shipping.trackingNumber}`}\n </Text>\n {data.shipping.estimatedDelivery && (\n <Text noMargin variant=\"xs\">\n {`Est. Delivery: ${data.shipping.estimatedDelivery}`}\n </Text>\n )}\n </View>\n <View style={{ marginLeft: \"auto\", width: 220 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={summaryItems}\n divided\n />\n </View>\n </Section>\n {(data.thankYouMessage || data.returnsPolicy) && (\n <Section\n spacing=\"sm\"\n variant=\"highlight\"\n accentColor={data.accentColor}\n >\n {data.thankYouMessage && (\n <Text variant=\"sm\" weight=\"medium\" noMargin>\n {data.thankYouMessage}\n </Text>\n )}\n {data.returnsPolicy && (\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {data.returnsPolicy}\n </Text>\n )}\n </Section>\n )}\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const PackingSlipDocument = ({\n theme,\n data,\n ...props\n}: {\n theme?: PdfcnTheme;\n data?: PackingSlipProps;\n} & Partial<PackingSlipProps>) => (\n <PdfcnThemeProvider theme={theme}>\n <PackingSlipContent data={{ ...sampleData, ...data, ...props }} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/packing-slip/packing-slip.tsx"
},
@@ -32,4 +32,4 @@
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/page-break.json b/apps/web/public/r/forme/page-break.json
index 31e05aa..ce85fea 100644
--- a/apps/web/public/r/forme/page-break.json
+++ b/apps/web/public/r/forme/page-break.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/forme/components/page-break/page-break.tsx",
- "content": "import { PageBreak as FormePageBreak } from \"@formepdf/react\";\r\n\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\n\r\nexport interface PageBreakProps extends Omit<PDFComponentProps, \"children\"> {\r\n children?: never;\r\n}\r\n\r\nexport const PageBreak = (_props: PageBreakProps) => <FormePageBreak />;\r\n",
+ "content": "import { PageBreak as FormePageBreak } from \"@formepdf/react\";\n\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\n\nexport interface PageBreakProps extends Omit<PDFComponentProps, \"children\"> {\n children?: never;\n}\n\nexport const PageBreak = (_props: PageBreakProps) => <FormePageBreak />;\n",
"type": "registry:component",
"target": "components/pdf/page-break/page-break.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/page-footer.json b/apps/web/public/r/forme/page-footer.json
index 4e44b9f..ebbd172 100644
--- a/apps/web/public/r/forme/page-footer.json
+++ b/apps/web/public/r/forme/page-footer.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/forme/components/page-footer/page-footer.tsx",
- "content": "import type React from \"react\";\r\n\r\nimport {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport {\r\n Fixed,\r\n Text as PDFText,\r\n StyleSheet,\r\n View,\r\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nconst wrapFixed = (\r\n fixed: boolean | undefined,\r\n node: React.ReactElement,\r\n footerOffset = 0\r\n) => {\r\n if (!fixed) {\r\n return node;\r\n }\r\n const nodeProps = node.props as {\r\n children?: React.ReactNode;\r\n style?: Style;\r\n };\r\n return (\r\n <Fixed\r\n position=\"footer\"\r\n style={[\r\n nodeProps.style,\r\n footerOffset ? { marginBottom: -footerOffset } : undefined,\r\n ]}\r\n >\r\n {nodeProps.children}\r\n </Fixed>\r\n );\r\n};\r\nexport type PageFooterVariant =\r\n | \"simple\"\r\n | \"centered\"\r\n | \"branded\"\r\n | \"minimal\"\r\n | \"three-column\"\r\n | \"detailed\";\r\n\r\n/**\r\n * Footer row with layout variants, optional sticky or fixed positioning, and contact info support.\r\n * Props - `leftText` | `rightText` | `centerText` | `variant` | `background` | `textColor` | `marginTop` | `address` | `phone` | `email` | `website` | `fixed` | `sticky` | `pagePadding` | `noWrap` | `style`\r\n * @see {@link PageFooterProps}\r\n */\r\nexport interface PageFooterProps extends Omit<PDFComponentProps, \"children\"> {\r\n leftText?: string;\r\n rightText?: string;\r\n centerText?: string;\r\n /**\r\n * @default 'simple'\r\n */\r\n variant?: PageFooterVariant;\r\n background?: string;\r\n textColor?: string;\r\n marginTop?: number;\r\n address?: string;\r\n phone?: string;\r\n email?: string;\r\n website?: string;\r\n /**\r\n * @default false\r\n */\r\n fixed?: boolean;\r\n /**\r\n * @default false\r\n */\r\n sticky?: boolean;\r\n /**\r\n * @default 0\r\n */\r\n pagePadding?: number;\r\n /**\r\n * @default true\r\n */\r\n noWrap?: boolean;\r\n}\r\n\r\nconst createPageFooterStyles = (t: PdfcnTheme) => {\r\n const { spacing, fontWeights } = t.primitives;\r\n const c = t.colors;\r\n const { body } = t.typography;\r\n\r\n const textBase = {\r\n color: c.mutedForeground,\r\n fontFamily: body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n lineHeight: body.lineHeight,\r\n };\r\n\r\n return StyleSheet.create({\r\n brandedContainer: {\r\n alignItems: \"center\",\r\n backgroundColor: c.primary,\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n paddingHorizontal: spacing[4],\r\n paddingVertical: spacing[3],\r\n },\r\n\r\n centeredContainer: {\r\n alignItems: \"center\",\r\n borderTopColor: c.border,\r\n borderTopStyle: \"solid\",\r\n borderTopWidth: spacing[0.5],\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n paddingTop: spacing[3],\r\n },\r\n\r\n companyBold: {\r\n ...textBase,\r\n color: c.foreground,\r\n fontWeight: fontWeights.bold,\r\n },\r\n\r\n companyName: {\r\n ...textBase,\r\n color: c.foreground,\r\n fontWeight: fontWeights.medium,\r\n },\r\n\r\n contactInfoCenter: {\r\n ...textBase,\r\n fontSize: t.primitives.typography.xs - 1,\r\n marginTop: spacing[0.5],\r\n textAlign: \"center\",\r\n },\r\n detailedContainer: {\r\n borderTopColor: c.border,\r\n borderTopStyle: \"solid\",\r\n borderTopWidth: spacing[1],\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n paddingTop: spacing[3],\r\n },\r\n detailedLeft: {\r\n display: \"flex\",\r\n flex: 1,\r\n flexDirection: \"column\",\r\n },\r\n detailedPageNumber: {\r\n ...textBase,\r\n borderTopColor: c.border,\r\n borderTopStyle: \"solid\",\r\n borderTopWidth: spacing[0.5],\r\n paddingTop: spacing[2],\r\n textAlign: \"center\",\r\n },\r\n detailedRight: {\r\n alignItems: \"flex-end\",\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n },\r\n detailedTopRow: {\r\n alignItems: \"flex-start\",\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n marginBottom: spacing[2],\r\n },\r\n\r\n minimalContainer: {\r\n alignItems: \"center\",\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n paddingBottom: spacing[1],\r\n paddingTop: spacing[1],\r\n },\r\n simpleContainer: {\r\n alignItems: \"center\",\r\n borderTopColor: c.border,\r\n borderTopStyle: \"solid\",\r\n borderTopWidth: spacing[0.5],\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n paddingTop: spacing[3],\r\n },\r\n simpleTextCenter: {\r\n ...textBase,\r\n textAlign: \"center\",\r\n },\r\n simpleTextLeft: {\r\n ...textBase,\r\n },\r\n simpleTextRight: {\r\n ...textBase,\r\n textAlign: \"right\",\r\n },\r\n textBranded: {\r\n ...textBase,\r\n color: c.primaryForeground,\r\n fontWeight: fontWeights.medium,\r\n },\r\n textBrandedRight: {\r\n ...textBase,\r\n color: c.primaryForeground,\r\n textAlign: \"right\",\r\n },\r\n textCenter: {\r\n ...textBase,\r\n flex: 1,\r\n textAlign: \"center\",\r\n },\r\n textCenteredVariant: {\r\n ...textBase,\r\n marginBottom: spacing[1],\r\n textAlign: \"center\",\r\n },\r\n\r\n textLeft: {\r\n ...textBase,\r\n flex: 1,\r\n },\r\n textRight: {\r\n ...textBase,\r\n textAlign: \"right\",\r\n },\r\n threeColumnCenter: {\r\n alignItems: \"center\",\r\n display: \"flex\",\r\n flex: 1,\r\n flexDirection: \"column\",\r\n },\r\n threeColumnContainer: {\r\n alignItems: \"flex-start\",\r\n borderTopColor: c.border,\r\n borderTopStyle: \"solid\",\r\n borderTopWidth: spacing[0.5],\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n paddingTop: spacing[3],\r\n },\r\n threeColumnLeft: {\r\n display: \"flex\",\r\n flex: 1,\r\n flexDirection: \"column\",\r\n },\r\n threeColumnRight: {\r\n alignItems: \"flex-end\",\r\n display: \"flex\",\r\n flex: 1,\r\n flexDirection: \"column\",\r\n },\r\n });\r\n};\r\n\r\ntype Styles = ReturnType<typeof createPageFooterStyles>;\r\n\r\nconst applyTextColor = (\r\n styles: Style[],\r\n color: string | undefined\r\n): Style[] => {\r\n if (!color) {\r\n return styles;\r\n }\r\n return [...styles, { color }];\r\n};\r\n\r\nconst renderBranded = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n leftStyle: Style[],\r\n rightStyle: Style[],\r\n leftText: string | undefined,\r\n rightText: string | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles as never}>\r\n {leftText && <PDFText style={leftStyle as never}>{leftText}</PDFText>}\r\n {rightText && <PDFText style={rightStyle as never}>{rightText}</PDFText>}\r\n </View>\r\n);\r\n\r\nconst renderCentered = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n textStyle: Style[],\r\n leftText: string | undefined,\r\n rightText: string | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles as never}>\r\n {leftText && <PDFText style={textStyle as never}>{leftText}</PDFText>}\r\n {rightText && <PDFText style={textStyle as never}>{rightText}</PDFText>}\r\n </View>\r\n);\r\n\r\nconst renderThreeColumn = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n leftStyle: Style[],\r\n centerStyle: Style[],\r\n rightStyle: Style[],\r\n leftText: string | undefined,\r\n rightText: string | undefined,\r\n address: string | undefined,\r\n phone: string | undefined,\r\n email: string | undefined,\r\n website: string | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles as never}>\r\n <View style={styles.threeColumnLeft}>\r\n {leftText && <PDFText style={leftStyle as never}>{leftText}</PDFText>}\r\n {address && <PDFText style={styles.textLeft}>{address}</PDFText>}\r\n </View>\r\n <View style={styles.threeColumnCenter}>\r\n {phone && <PDFText style={centerStyle as never}>{phone}</PDFText>}\r\n {email && <PDFText style={centerStyle as never}>{email}</PDFText>}\r\n {website && <PDFText style={centerStyle as never}>{website}</PDFText>}\r\n </View>\r\n <View style={styles.threeColumnRight}>\r\n {rightText && <PDFText style={rightStyle as never}>{rightText}</PDFText>}\r\n </View>\r\n </View>\r\n);\r\n\r\nconst renderDetailed = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n companyStyle: Style[],\r\n addrStyle: Style[],\r\n contactStyle: Style[],\r\n pageNumStyle: Style[],\r\n leftText: string | undefined,\r\n rightText: string | undefined,\r\n address: string | undefined,\r\n phone: string | undefined,\r\n email: string | undefined,\r\n website: string | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles as never}>\r\n <View style={styles.detailedTopRow}>\r\n <View style={styles.detailedLeft}>\r\n {leftText && (\r\n <PDFText style={companyStyle as never}>{leftText}</PDFText>\r\n )}\r\n {address && <PDFText style={addrStyle as never}>{address}</PDFText>}\r\n </View>\r\n <View style={styles.detailedRight}>\r\n {phone && (\r\n <PDFText style={contactStyle as never}>{`Phone: ${phone}`}</PDFText>\r\n )}\r\n {email && (\r\n <PDFText style={contactStyle as never}>{`Email: ${email}`}</PDFText>\r\n )}\r\n {website && (\r\n <PDFText style={contactStyle as never}>{`Web: ${website}`}</PDFText>\r\n )}\r\n </View>\r\n </View>\r\n {rightText && <PDFText style={pageNumStyle as never}>{rightText}</PDFText>}\r\n </View>\r\n);\r\n\r\nconst renderMinimal = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n leftStyle: Style[],\r\n rightStyle: Style[],\r\n leftText: string | undefined,\r\n rightText: string | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles as never}>\r\n {leftText && <PDFText style={leftStyle as never}>{leftText}</PDFText>}\r\n {rightText && <PDFText style={rightStyle as never}>{rightText}</PDFText>}\r\n </View>\r\n);\r\n\r\nconst renderSimple = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n leftStyle: Style[],\r\n centerStyle: Style[],\r\n rightStyle: Style[],\r\n leftText: string | undefined,\r\n centerText: string | undefined,\r\n rightText: string | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles as never}>\r\n {leftText && <PDFText style={leftStyle as never}>{leftText}</PDFText>}\r\n {centerText && <PDFText style={centerStyle as never}>{centerText}</PDFText>}\r\n {rightText && <PDFText style={rightStyle as never}>{rightText}</PDFText>}\r\n </View>\r\n);\r\n\r\nexport const PageFooter = ({\r\n leftText,\r\n rightText,\r\n centerText,\r\n variant = \"simple\",\r\n background,\r\n textColor,\r\n marginTop,\r\n address,\r\n phone,\r\n email,\r\n website,\r\n fixed = false,\r\n sticky = false,\r\n pagePadding = 0,\r\n noWrap = true,\r\n style,\r\n}: PageFooterProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createPageFooterStyles(theme), [theme]);\r\n const _isFixed = fixed || sticky;\r\n const mt = sticky ? 0 : (marginTop ?? theme.spacing.sectionGap);\r\n const resolvedTextColor = textColor\r\n ? resolveColor(textColor, theme.colors)\r\n : undefined;\r\n const stickyStyle: Style = {};\r\n\r\n const applyOverrides = (base: Style[]): Style[] => {\r\n if (background) {\r\n base.push({ backgroundColor: resolveColor(background, theme.colors) });\r\n }\r\n if (style) {\r\n base.push(style);\r\n }\r\n if (sticky) {\r\n base.push(stickyStyle);\r\n }\r\n return base;\r\n };\r\n\r\n const variantRenderers: Record<PageFooterVariant, () => React.ReactNode> = {\r\n branded: () =>\r\n renderBranded(\r\n styles,\r\n applyOverrides([styles.brandedContainer, { marginTop: mt }]),\r\n applyTextColor([styles.textBranded], resolvedTextColor),\r\n applyTextColor([styles.textBrandedRight], resolvedTextColor),\r\n leftText,\r\n rightText,\r\n noWrap\r\n ),\r\n centered: () =>\r\n renderCentered(\r\n styles,\r\n applyOverrides([styles.centeredContainer, { marginTop: mt }]),\r\n applyTextColor([styles.textCenteredVariant], resolvedTextColor),\r\n leftText,\r\n rightText,\r\n noWrap\r\n ),\r\n detailed: () =>\r\n renderDetailed(\r\n styles,\r\n applyOverrides([styles.detailedContainer, { marginTop: mt }]),\r\n applyTextColor([styles.companyBold], resolvedTextColor),\r\n applyTextColor([styles.textLeft], resolvedTextColor),\r\n applyTextColor([styles.textRight], resolvedTextColor),\r\n applyTextColor([styles.detailedPageNumber], resolvedTextColor),\r\n leftText,\r\n rightText,\r\n address,\r\n phone,\r\n email,\r\n website,\r\n noWrap\r\n ),\r\n minimal: () =>\r\n renderMinimal(\r\n styles,\r\n applyOverrides([styles.minimalContainer, { marginTop: mt }]),\r\n applyTextColor([styles.textLeft], resolvedTextColor),\r\n applyTextColor([styles.textRight], resolvedTextColor),\r\n leftText,\r\n rightText,\r\n noWrap\r\n ),\r\n simple: () =>\r\n renderSimple(\r\n styles,\r\n applyOverrides([styles.simpleContainer, { marginTop: mt }]),\r\n applyTextColor(\r\n [styles.simpleTextLeft, { width: centerText ? 160 : 360 }],\r\n resolvedTextColor\r\n ),\r\n applyTextColor(\r\n [styles.simpleTextCenter, { width: 160 }],\r\n resolvedTextColor\r\n ),\r\n applyTextColor(\r\n [styles.simpleTextRight, { width: centerText ? 160 : 120 }],\r\n resolvedTextColor\r\n ),\r\n leftText,\r\n centerText,\r\n rightText,\r\n noWrap\r\n ),\r\n \"three-column\": () =>\r\n renderThreeColumn(\r\n styles,\r\n applyOverrides([styles.threeColumnContainer, { marginTop: mt }]),\r\n applyTextColor([styles.companyName], resolvedTextColor),\r\n applyTextColor([styles.contactInfoCenter], resolvedTextColor),\r\n applyTextColor([styles.textRight], resolvedTextColor),\r\n leftText,\r\n rightText,\r\n address,\r\n phone,\r\n email,\r\n website,\r\n noWrap\r\n ),\r\n };\r\n\r\n return wrapFixed(\r\n _isFixed,\r\n variantRenderers[variant]() as React.ReactElement,\r\n sticky ? Math.max(theme.spacing.page.marginBottom - pagePadding, 0) : 0\r\n );\r\n};\r\n",
+ "content": "import type React from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Fixed,\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nconst wrapFixed = (\n fixed: boolean | undefined,\n node: React.ReactElement,\n footerOffset = 0\n) => {\n if (!fixed) {\n return node;\n }\n const nodeProps = node.props as {\n children?: React.ReactNode;\n style?: Style;\n };\n return (\n <Fixed\n position=\"footer\"\n style={[\n nodeProps.style,\n footerOffset ? { marginBottom: -footerOffset } : undefined,\n ]}\n >\n {nodeProps.children}\n </Fixed>\n );\n};\nexport type PageFooterVariant =\n | \"simple\"\n | \"centered\"\n | \"branded\"\n | \"minimal\"\n | \"three-column\"\n | \"detailed\";\n\n/**\n * Footer row with layout variants, optional sticky or fixed positioning, and contact info support.\n * Props - `leftText` | `rightText` | `centerText` | `variant` | `background` | `textColor` | `marginTop` | `address` | `phone` | `email` | `website` | `fixed` | `sticky` | `pagePadding` | `noWrap` | `style`\n * @see {@link PageFooterProps}\n */\nexport interface PageFooterProps extends Omit<PDFComponentProps, \"children\"> {\n leftText?: React.ReactNode;\n rightText?: React.ReactNode;\n centerText?: React.ReactNode;\n /**\n * @default 'simple'\n */\n variant?: PageFooterVariant;\n background?: string;\n textColor?: string;\n marginTop?: number;\n address?: string;\n phone?: string;\n email?: string;\n website?: string;\n /**\n * @default false\n */\n fixed?: boolean;\n /**\n * @default false\n */\n sticky?: boolean;\n /**\n * @default 0\n */\n pagePadding?: number;\n /**\n * @default true\n */\n noWrap?: boolean;\n}\n\nconst createPageFooterStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights } = t.primitives;\n const c = t.colors;\n const { body } = t.typography;\n\n const textBase = {\n color: c.mutedForeground,\n fontFamily: body.fontFamily,\n fontSize: t.primitives.typography.xs,\n lineHeight: body.lineHeight,\n };\n\n return StyleSheet.create({\n brandedContainer: {\n alignItems: \"center\",\n backgroundColor: c.primary,\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingHorizontal: spacing[4],\n paddingVertical: spacing[3],\n },\n\n centeredContainer: {\n alignItems: \"center\",\n borderTopColor: c.border,\n borderTopStyle: \"solid\",\n borderTopWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"column\",\n paddingTop: spacing[3],\n },\n\n companyBold: {\n ...textBase,\n color: c.foreground,\n fontWeight: fontWeights.bold,\n },\n\n companyName: {\n ...textBase,\n color: c.foreground,\n fontWeight: fontWeights.medium,\n },\n\n contactInfoCenter: {\n ...textBase,\n fontSize: t.primitives.typography.xs - 1,\n marginTop: spacing[0.5],\n textAlign: \"center\",\n },\n detailedContainer: {\n borderTopColor: c.border,\n borderTopStyle: \"solid\",\n borderTopWidth: spacing[1],\n display: \"flex\",\n flexDirection: \"column\",\n paddingTop: spacing[3],\n },\n detailedLeft: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n detailedPageNumber: {\n ...textBase,\n borderTopColor: c.border,\n borderTopStyle: \"solid\",\n borderTopWidth: spacing[0.5],\n paddingTop: spacing[2],\n textAlign: \"center\",\n },\n detailedRight: {\n alignItems: \"flex-end\",\n display: \"flex\",\n flexDirection: \"column\",\n },\n detailedTopRow: {\n alignItems: \"flex-start\",\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: spacing[2],\n },\n\n minimalContainer: {\n alignItems: \"center\",\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: spacing[1],\n paddingTop: spacing[1],\n },\n simpleContainer: {\n alignItems: \"center\",\n borderTopColor: c.border,\n borderTopStyle: \"solid\",\n borderTopWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingTop: spacing[3],\n },\n simpleTextCenter: {\n ...textBase,\n textAlign: \"center\",\n },\n simpleTextLeft: {\n ...textBase,\n },\n simpleTextRight: {\n ...textBase,\n textAlign: \"right\",\n },\n textBranded: {\n ...textBase,\n color: c.primaryForeground,\n fontWeight: fontWeights.medium,\n },\n textBrandedRight: {\n ...textBase,\n color: c.primaryForeground,\n textAlign: \"right\",\n },\n textCenter: {\n ...textBase,\n flex: 1,\n textAlign: \"center\",\n },\n textCenteredVariant: {\n ...textBase,\n marginBottom: spacing[1],\n textAlign: \"center\",\n },\n\n textLeft: {\n ...textBase,\n flex: 1,\n },\n textRight: {\n ...textBase,\n textAlign: \"right\",\n },\n threeColumnCenter: {\n alignItems: \"center\",\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n threeColumnContainer: {\n alignItems: \"flex-start\",\n borderTopColor: c.border,\n borderTopStyle: \"solid\",\n borderTopWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingTop: spacing[3],\n },\n threeColumnLeft: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n threeColumnRight: {\n alignItems: \"flex-end\",\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n });\n};\n\ntype Styles = ReturnType<typeof createPageFooterStyles>;\n\nconst applyTextColor = (\n styles: Style[],\n color: string | undefined\n): Style[] => {\n if (!color) {\n return styles;\n }\n return [...styles, { color }];\n};\n\n/**\n * A footer slot's content. A plain string is wrapped in a PDF text node, as\n * before; anything else is rendered as given, because `@formepdf/react`'s\n * `Text` accepts string children only — a `<PageNumber />` (which is a View\n * wrapping a Text) cannot nest inside one. Widening these slots to a node is\n * what lets a block pass the real page-number component instead of a literal.\n */\nconst footerSlot = (value: React.ReactNode, style: Style[]) =>\n typeof value === \"string\" ? (\n <PDFText style={style as never}>{value}</PDFText>\n ) : (\n value\n );\n\nconst renderBranded = (\n styles: Styles,\n containerStyles: Style[],\n leftStyle: Style[],\n rightStyle: Style[],\n leftText: React.ReactNode,\n rightText: React.ReactNode,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n {leftText && footerSlot(leftText, leftStyle)}\n {rightText && footerSlot(rightText, rightStyle)}\n </View>\n);\n\nconst renderCentered = (\n styles: Styles,\n containerStyles: Style[],\n textStyle: Style[],\n leftText: React.ReactNode,\n rightText: React.ReactNode,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n {leftText && footerSlot(leftText, textStyle)}\n {rightText && footerSlot(rightText, textStyle)}\n </View>\n);\n\nconst renderThreeColumn = (\n styles: Styles,\n containerStyles: Style[],\n leftStyle: Style[],\n centerStyle: Style[],\n rightStyle: Style[],\n leftText: React.ReactNode,\n rightText: React.ReactNode,\n address: string | undefined,\n phone: string | undefined,\n email: string | undefined,\n website: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <View style={styles.threeColumnLeft}>\n {leftText && footerSlot(leftText, leftStyle)}\n {address && <PDFText style={styles.textLeft}>{address}</PDFText>}\n </View>\n <View style={styles.threeColumnCenter}>\n {phone && <PDFText style={centerStyle as never}>{phone}</PDFText>}\n {email && <PDFText style={centerStyle as never}>{email}</PDFText>}\n {website && <PDFText style={centerStyle as never}>{website}</PDFText>}\n </View>\n <View style={styles.threeColumnRight}>\n {rightText && footerSlot(rightText, rightStyle)}\n </View>\n </View>\n);\n\nconst renderDetailed = (\n styles: Styles,\n containerStyles: Style[],\n companyStyle: Style[],\n addrStyle: Style[],\n contactStyle: Style[],\n pageNumStyle: Style[],\n leftText: React.ReactNode,\n rightText: React.ReactNode,\n address: string | undefined,\n phone: string | undefined,\n email: string | undefined,\n website: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <View style={styles.detailedTopRow}>\n <View style={styles.detailedLeft}>\n {leftText && footerSlot(leftText, companyStyle)}\n {address && <PDFText style={addrStyle as never}>{address}</PDFText>}\n </View>\n <View style={styles.detailedRight}>\n {phone && (\n <PDFText style={contactStyle as never}>{`Phone: ${phone}`}</PDFText>\n )}\n {email && (\n <PDFText style={contactStyle as never}>{`Email: ${email}`}</PDFText>\n )}\n {website && (\n <PDFText style={contactStyle as never}>{`Web: ${website}`}</PDFText>\n )}\n </View>\n </View>\n {rightText && footerSlot(rightText, pageNumStyle)}\n </View>\n);\n\nconst renderMinimal = (\n styles: Styles,\n containerStyles: Style[],\n leftStyle: Style[],\n rightStyle: Style[],\n leftText: React.ReactNode,\n rightText: React.ReactNode,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n {leftText && footerSlot(leftText, leftStyle)}\n {rightText && footerSlot(rightText, rightStyle)}\n </View>\n);\n\nconst renderSimple = (\n styles: Styles,\n containerStyles: Style[],\n leftStyle: Style[],\n centerStyle: Style[],\n rightStyle: Style[],\n leftText: React.ReactNode,\n centerText: React.ReactNode,\n rightText: React.ReactNode,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n {leftText && footerSlot(leftText, leftStyle)}\n {centerText && footerSlot(centerText, centerStyle)}\n {rightText && footerSlot(rightText, rightStyle)}\n </View>\n);\n\nexport const PageFooter = ({\n leftText,\n rightText,\n centerText,\n variant = \"simple\",\n background,\n textColor,\n marginTop,\n address,\n phone,\n email,\n website,\n fixed = false,\n sticky = false,\n pagePadding = 0,\n noWrap = true,\n style,\n}: PageFooterProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createPageFooterStyles(theme), [theme]);\n const _isFixed = fixed || sticky;\n const mt = sticky ? 0 : (marginTop ?? theme.spacing.sectionGap);\n const resolvedTextColor = textColor\n ? resolveColor(textColor, theme.colors)\n : undefined;\n const stickyStyle: Style = {};\n\n const applyOverrides = (base: Style[]): Style[] => {\n if (background) {\n base.push({ backgroundColor: resolveColor(background, theme.colors) });\n }\n if (style) {\n base.push(style);\n }\n if (sticky) {\n base.push(stickyStyle);\n }\n return base;\n };\n\n const variantRenderers: Record<PageFooterVariant, () => React.ReactNode> = {\n branded: () =>\n renderBranded(\n styles,\n applyOverrides([styles.brandedContainer, { marginTop: mt }]),\n applyTextColor([styles.textBranded], resolvedTextColor),\n applyTextColor([styles.textBrandedRight], resolvedTextColor),\n leftText,\n rightText,\n noWrap\n ),\n centered: () =>\n renderCentered(\n styles,\n applyOverrides([styles.centeredContainer, { marginTop: mt }]),\n applyTextColor([styles.textCenteredVariant], resolvedTextColor),\n leftText,\n rightText,\n noWrap\n ),\n detailed: () =>\n renderDetailed(\n styles,\n applyOverrides([styles.detailedContainer, { marginTop: mt }]),\n applyTextColor([styles.companyBold], resolvedTextColor),\n applyTextColor([styles.textLeft], resolvedTextColor),\n applyTextColor([styles.textRight], resolvedTextColor),\n applyTextColor([styles.detailedPageNumber], resolvedTextColor),\n leftText,\n rightText,\n address,\n phone,\n email,\n website,\n noWrap\n ),\n minimal: () =>\n renderMinimal(\n styles,\n applyOverrides([styles.minimalContainer, { marginTop: mt }]),\n applyTextColor([styles.textLeft], resolvedTextColor),\n applyTextColor([styles.textRight], resolvedTextColor),\n leftText,\n rightText,\n noWrap\n ),\n simple: () =>\n renderSimple(\n styles,\n applyOverrides([styles.simpleContainer, { marginTop: mt }]),\n applyTextColor(\n [styles.simpleTextLeft, { width: centerText ? 160 : 360 }],\n resolvedTextColor\n ),\n applyTextColor(\n [styles.simpleTextCenter, { width: 160 }],\n resolvedTextColor\n ),\n applyTextColor(\n [styles.simpleTextRight, { width: centerText ? 160 : 120 }],\n resolvedTextColor\n ),\n leftText,\n centerText,\n rightText,\n noWrap\n ),\n \"three-column\": () =>\n renderThreeColumn(\n styles,\n applyOverrides([styles.threeColumnContainer, { marginTop: mt }]),\n applyTextColor([styles.companyName], resolvedTextColor),\n applyTextColor([styles.contactInfoCenter], resolvedTextColor),\n applyTextColor([styles.textRight], resolvedTextColor),\n leftText,\n rightText,\n address,\n phone,\n email,\n website,\n noWrap\n ),\n };\n\n return wrapFixed(\n _isFixed,\n variantRenderers[variant]() as React.ReactElement,\n sticky ? Math.max(theme.spacing.page.marginBottom - pagePadding, 0) : 0\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/page-footer/page-footer.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/page-header.json b/apps/web/public/r/forme/page-header.json
index 82a43fe..1906173 100644
--- a/apps/web/public/r/forme/page-header.json
+++ b/apps/web/public/r/forme/page-header.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/forme/components/page-header/page-header.tsx",
- "content": "import type React from \"react\";\r\nimport type { ReactNode } from \"react\";\r\n\r\nimport {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport {\r\n Fixed,\r\n Text as PDFText,\r\n StyleSheet,\r\n View,\r\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nconst wrapFixed = (fixed: boolean | undefined, node: React.ReactElement) => {\r\n if (!fixed) {\r\n return node;\r\n }\r\n return <Fixed position=\"header\">{node}</Fixed>;\r\n};\r\nexport type PageHeaderVariant =\r\n | \"simple\"\r\n | \"centered\"\r\n | \"minimal\"\r\n | \"branded\"\r\n | \"logo-left\"\r\n | \"logo-right\"\r\n | \"two-column\";\r\n\r\n/**\r\n * Header row with layout variants, logo support, and optional fixed positioning.\r\n * Props - `title` | `subtitle` | `rightText` | `rightSubText` | `variant` | `background` | `titleColor` | `marginBottom` | `address` | `phone` | `email` | `logo` | `fixed` | `noWrap` | `style`\r\n * @see {@link PageHeaderProps}\r\n */\r\nexport interface PageHeaderProps extends Omit<PDFComponentProps, \"children\"> {\r\n title: string;\r\n subtitle?: string;\r\n rightText?: string;\r\n rightSubText?: string;\r\n /**\r\n * @default 'simple'\r\n */\r\n variant?: PageHeaderVariant;\r\n background?: string;\r\n titleColor?: string;\r\n marginBottom?: number;\r\n address?: string;\r\n phone?: string;\r\n email?: string;\r\n logo?: ReactNode;\r\n /**\r\n * @default false\r\n */\r\n fixed?: boolean;\r\n /**\r\n * @default true\r\n */\r\n noWrap?: boolean;\r\n}\r\n\r\nconst createPageHeaderStyles = (t: PdfcnTheme) => {\r\n const { spacing, borderRadius, fontWeights } = t.primitives;\r\n const c = t.colors;\r\n const { heading, body } = t.typography;\r\n\r\n return StyleSheet.create({\r\n brandedContainer: {\r\n alignItems: \"center\",\r\n backgroundColor: c.primary,\r\n borderRadius: borderRadius.sm,\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n padding: spacing[6],\r\n },\r\n centeredContainer: {\r\n alignItems: \"center\",\r\n borderBottomColor: c.border,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: spacing[0.5],\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n paddingBottom: spacing[4],\r\n },\r\n contactInfo: {\r\n color: c.mutedForeground,\r\n fontFamily: body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n marginTop: spacing[0.5],\r\n textAlign: \"right\",\r\n },\r\n\r\n logoContainer: {\r\n flexShrink: 0,\r\n height: 48,\r\n marginRight: spacing[4],\r\n width: 48,\r\n },\r\n\r\n logoContent: {\r\n display: \"flex\",\r\n flex: 1,\r\n flexDirection: \"column\",\r\n paddingLeft: spacing[4],\r\n },\r\n logoLeftContainer: {\r\n alignItems: \"center\",\r\n borderBottomColor: c.border,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: spacing[0.5],\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n paddingBottom: spacing[4],\r\n },\r\n logoRightContainer: {\r\n alignItems: \"center\",\r\n borderBottomColor: c.border,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: spacing[0.5],\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n paddingBottom: spacing[4],\r\n },\r\n\r\n logoRightContent: {\r\n display: \"flex\",\r\n flex: 1,\r\n flexDirection: \"column\",\r\n },\r\n\r\n logoRightLogoContainer: {\r\n flexShrink: 0,\r\n height: 48,\r\n marginLeft: spacing[4],\r\n width: 48,\r\n },\r\n minimalContainer: {\r\n alignItems: \"center\",\r\n borderBottomColor: c.primary,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: spacing[1],\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n paddingBottom: spacing[3],\r\n },\r\n minimalLeft: {\r\n flex: 1,\r\n },\r\n minimalRight: {\r\n alignItems: \"flex-end\",\r\n },\r\n\r\n rightSubText: {\r\n color: c.mutedForeground,\r\n fontFamily: body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n marginTop: spacing[1],\r\n textAlign: \"right\",\r\n },\r\n rightText: {\r\n color: c.foreground,\r\n fontFamily: body.fontFamily,\r\n fontSize: body.fontSize,\r\n fontWeight: fontWeights.medium,\r\n textAlign: \"right\",\r\n },\r\n simpleContainer: {\r\n alignItems: \"flex-start\",\r\n borderBottomColor: c.border,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: spacing[0.5],\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n paddingBottom: spacing[4],\r\n },\r\n\r\n simpleLeft: {\r\n display: \"flex\",\r\n flex: 1,\r\n flexDirection: \"column\",\r\n },\r\n simpleRight: {\r\n alignItems: \"flex-end\",\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n },\r\n\r\n subtitle: {\r\n color: c.mutedForeground,\r\n fontFamily: body.fontFamily,\r\n fontSize: body.fontSize,\r\n lineHeight: body.lineHeight,\r\n marginTop: spacing[1],\r\n },\r\n subtitleBranded: {\r\n color: c.primaryForeground,\r\n marginTop: spacing[1],\r\n },\r\n subtitleCentered: {\r\n textAlign: \"center\",\r\n },\r\n\r\n title: {\r\n color: c.foreground,\r\n fontFamily: heading.fontFamily,\r\n fontSize: heading.fontSize.h3,\r\n fontWeight: fontWeights.bold,\r\n lineHeight: heading.lineHeight,\r\n marginBottom: 0,\r\n },\r\n titleBranded: {\r\n color: c.primaryForeground,\r\n },\r\n titleCentered: {\r\n textAlign: \"center\",\r\n },\r\n\r\n titleMinimal: {\r\n fontSize: heading.fontSize.h3,\r\n fontWeight: fontWeights.bold,\r\n },\r\n twoColumnContainer: {\r\n alignItems: \"flex-start\",\r\n borderBottomColor: c.border,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: spacing[0.5],\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n paddingBottom: spacing[4],\r\n },\r\n twoColumnLeft: {\r\n display: \"flex\",\r\n flex: 1,\r\n flexDirection: \"column\",\r\n },\r\n twoColumnRight: {\r\n alignItems: \"flex-end\",\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n },\r\n });\r\n};\r\n\r\ntype Styles = ReturnType<typeof createPageHeaderStyles>;\r\n\r\nconst buildContainerStyles = (\r\n base: Style,\r\n mb: number,\r\n background: string | undefined,\r\n theme: PdfcnTheme,\r\n style: Style | undefined,\r\n ...extras: Style[]\r\n): Style[] => {\r\n const result: Style[] = [base, { marginBottom: mb }, ...extras];\r\n if (background) {\r\n result.push({ backgroundColor: resolveColor(background, theme.colors) });\r\n }\r\n if (style) {\r\n result.push(style);\r\n }\r\n return result;\r\n};\r\n\r\nconst buildTitleStyles = (\r\n base: Style[],\r\n titleColor: string | undefined,\r\n theme: PdfcnTheme\r\n): Style[] => {\r\n if (!titleColor) {\r\n return base;\r\n }\r\n return [...base, { color: resolveColor(titleColor, theme.colors) }];\r\n};\r\n\r\nconst renderBranded = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n titleStyles: Style[],\r\n title: string,\r\n subtitle: string | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles as never}>\r\n <PDFText style={titleStyles as never}>{title}</PDFText>\r\n {subtitle && (\r\n <PDFText style={[styles.subtitle, styles.subtitleBranded] as never}>\r\n {subtitle}\r\n </PDFText>\r\n )}\r\n </View>\r\n);\r\n\r\nconst renderCentered = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n titleStyles: Style[],\r\n title: string,\r\n subtitle: string | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles as never}>\r\n <PDFText style={titleStyles as never}>{title}</PDFText>\r\n {subtitle && (\r\n <PDFText style={[styles.subtitle, styles.subtitleCentered] as never}>\r\n {subtitle}\r\n </PDFText>\r\n )}\r\n </View>\r\n);\r\n\r\nconst renderLogoRight = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n titleStyles: Style[],\r\n title: string,\r\n subtitle: string | undefined,\r\n logo: ReactNode | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles as never}>\r\n <View style={styles.logoRightContent}>\r\n <PDFText style={titleStyles as never}>{title}</PDFText>\r\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\r\n </View>\r\n {logo && <View style={styles.logoRightLogoContainer}>{logo}</View>}\r\n </View>\r\n);\r\n\r\nconst renderLogoLeft = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n titleStyles: Style[],\r\n title: string,\r\n subtitle: string | undefined,\r\n logo: ReactNode | undefined,\r\n rightText: string | undefined,\r\n rightSubText: string | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles as never}>\r\n {logo && <View style={styles.logoContainer}>{logo}</View>}\r\n <View style={styles.logoContent}>\r\n <PDFText style={titleStyles as never}>{title}</PDFText>\r\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\r\n </View>\r\n {(rightText || rightSubText) && (\r\n <View style={styles.simpleRight}>\r\n {rightText && <PDFText style={styles.rightText}>{rightText}</PDFText>}\r\n {rightSubText && (\r\n <PDFText style={styles.rightSubText}>{rightSubText}</PDFText>\r\n )}\r\n </View>\r\n )}\r\n </View>\r\n);\r\n\r\nconst renderTwoColumn = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n titleStyles: Style[],\r\n title: string,\r\n subtitle: string | undefined,\r\n address: string | undefined,\r\n phone: string | undefined,\r\n email: string | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles as never}>\r\n <View style={styles.twoColumnLeft}>\r\n <PDFText style={titleStyles as never}>{title}</PDFText>\r\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\r\n </View>\r\n {(address || phone || email) && (\r\n <View style={styles.twoColumnRight}>\r\n {address && <PDFText style={styles.contactInfo}>{address}</PDFText>}\r\n {phone && <PDFText style={styles.contactInfo}>{phone}</PDFText>}\r\n {email && <PDFText style={styles.contactInfo}>{email}</PDFText>}\r\n </View>\r\n )}\r\n </View>\r\n);\r\n\r\nconst renderMinimal = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n titleStyles: Style[],\r\n title: string,\r\n subtitle: string | undefined,\r\n rightText: string | undefined,\r\n rightSubText: string | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles as never}>\r\n <View style={styles.minimalLeft}>\r\n <PDFText style={titleStyles as never}>{title}</PDFText>\r\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\r\n </View>\r\n {(rightText || rightSubText) && (\r\n <View style={styles.minimalRight}>\r\n {rightText && <PDFText style={styles.rightText}>{rightText}</PDFText>}\r\n {rightSubText && (\r\n <PDFText style={styles.rightSubText}>{rightSubText}</PDFText>\r\n )}\r\n </View>\r\n )}\r\n </View>\r\n);\r\n\r\nconst renderSimple = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n titleStyles: Style[],\r\n title: string,\r\n subtitle: string | undefined,\r\n rightText: string | undefined,\r\n rightSubText: string | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles as never}>\r\n <View style={styles.simpleLeft}>\r\n <PDFText style={titleStyles as never}>{title}</PDFText>\r\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\r\n </View>\r\n {(rightText || rightSubText) && (\r\n <View style={styles.simpleRight}>\r\n {rightText && <PDFText style={styles.rightText}>{rightText}</PDFText>}\r\n {rightSubText && (\r\n <PDFText style={styles.rightSubText}>{rightSubText}</PDFText>\r\n )}\r\n </View>\r\n )}\r\n </View>\r\n);\r\n\r\nexport const PageHeader = ({\r\n title,\r\n subtitle,\r\n rightText,\r\n rightSubText,\r\n variant = \"simple\",\r\n background,\r\n titleColor,\r\n marginBottom,\r\n logo,\r\n address,\r\n phone,\r\n email,\r\n fixed = false,\r\n noWrap = true,\r\n style,\r\n}: PageHeaderProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createPageHeaderStyles(theme), [theme]);\r\n const mb = marginBottom ?? theme.spacing.sectionGap;\r\n\r\n const variantRenderers: Record<PageHeaderVariant, () => React.ReactNode> = {\r\n branded: () =>\r\n renderBranded(\r\n styles,\r\n buildContainerStyles(\r\n styles.brandedContainer,\r\n mb,\r\n background,\r\n theme,\r\n style\r\n ),\r\n buildTitleStyles(\r\n [styles.title, styles.titleBranded, styles.titleCentered],\r\n titleColor,\r\n theme\r\n ),\r\n title,\r\n subtitle,\r\n noWrap\r\n ),\r\n centered: () =>\r\n renderCentered(\r\n styles,\r\n buildContainerStyles(\r\n styles.centeredContainer,\r\n mb,\r\n background,\r\n theme,\r\n style\r\n ),\r\n buildTitleStyles(\r\n [styles.title, styles.titleCentered],\r\n titleColor,\r\n theme\r\n ),\r\n title,\r\n subtitle,\r\n noWrap\r\n ),\r\n \"logo-left\": () =>\r\n renderLogoLeft(\r\n styles,\r\n buildContainerStyles(\r\n styles.logoLeftContainer,\r\n mb,\r\n background,\r\n theme,\r\n style\r\n ),\r\n buildTitleStyles([styles.title], titleColor, theme),\r\n title,\r\n subtitle,\r\n logo,\r\n rightText,\r\n rightSubText,\r\n noWrap\r\n ),\r\n \"logo-right\": () =>\r\n renderLogoRight(\r\n styles,\r\n buildContainerStyles(\r\n styles.logoRightContainer,\r\n mb,\r\n background,\r\n theme,\r\n style\r\n ),\r\n buildTitleStyles([styles.title], titleColor, theme),\r\n title,\r\n subtitle,\r\n logo,\r\n noWrap\r\n ),\r\n minimal: () =>\r\n renderMinimal(\r\n styles,\r\n buildContainerStyles(\r\n styles.minimalContainer,\r\n mb,\r\n background,\r\n theme,\r\n style\r\n ),\r\n buildTitleStyles(\r\n [styles.title, styles.titleMinimal],\r\n titleColor,\r\n theme\r\n ),\r\n title,\r\n subtitle,\r\n rightText,\r\n rightSubText,\r\n noWrap\r\n ),\r\n simple: () =>\r\n renderSimple(\r\n styles,\r\n buildContainerStyles(\r\n styles.simpleContainer,\r\n mb,\r\n background,\r\n theme,\r\n style\r\n ),\r\n buildTitleStyles([styles.title], titleColor, theme),\r\n title,\r\n subtitle,\r\n rightText,\r\n rightSubText,\r\n noWrap\r\n ),\r\n \"two-column\": () =>\r\n renderTwoColumn(\r\n styles,\r\n buildContainerStyles(\r\n styles.twoColumnContainer,\r\n mb,\r\n background,\r\n theme,\r\n style\r\n ),\r\n buildTitleStyles([styles.title], titleColor, theme),\r\n title,\r\n subtitle,\r\n address,\r\n phone,\r\n email,\r\n noWrap\r\n ),\r\n };\r\n\r\n return wrapFixed(fixed, variantRenderers[variant]() as React.ReactElement);\r\n};\r\n",
+ "content": "import type React from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Fixed,\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nconst wrapFixed = (fixed: boolean | undefined, node: React.ReactElement) => {\n if (!fixed) {\n return node;\n }\n return <Fixed position=\"header\">{node}</Fixed>;\n};\nexport type PageHeaderVariant =\n | \"simple\"\n | \"centered\"\n | \"minimal\"\n | \"branded\"\n | \"logo-left\"\n | \"logo-right\"\n | \"two-column\";\n\n/**\n * Header row with layout variants, logo support, and optional fixed positioning.\n * Props - `title` | `subtitle` | `rightText` | `rightSubText` | `variant` | `background` | `titleColor` | `marginBottom` | `address` | `phone` | `email` | `logo` | `fixed` | `noWrap` | `style`\n * @see {@link PageHeaderProps}\n */\nexport interface PageHeaderProps extends Omit<PDFComponentProps, \"children\"> {\n title: string;\n subtitle?: string;\n rightText?: string;\n rightSubText?: string;\n /**\n * @default 'simple'\n */\n variant?: PageHeaderVariant;\n background?: string;\n titleColor?: string;\n marginBottom?: number;\n address?: string;\n phone?: string;\n email?: string;\n logo?: ReactNode;\n /**\n * @default false\n */\n fixed?: boolean;\n /**\n * @default true\n */\n noWrap?: boolean;\n}\n\nconst createPageHeaderStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius, fontWeights } = t.primitives;\n const c = t.colors;\n const { heading, body } = t.typography;\n\n return StyleSheet.create({\n brandedContainer: {\n alignItems: \"center\",\n backgroundColor: c.primary,\n borderRadius: borderRadius.sm,\n display: \"flex\",\n flexDirection: \"column\",\n padding: spacing[6],\n },\n centeredContainer: {\n alignItems: \"center\",\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"column\",\n paddingBottom: spacing[4],\n },\n contactInfo: {\n color: c.mutedForeground,\n fontFamily: body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginTop: spacing[0.5],\n textAlign: \"right\",\n },\n\n logoContainer: {\n flexShrink: 0,\n height: 48,\n marginRight: spacing[4],\n width: 48,\n },\n\n logoContent: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n paddingLeft: spacing[4],\n },\n logoLeftContainer: {\n alignItems: \"center\",\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n paddingBottom: spacing[4],\n },\n logoRightContainer: {\n alignItems: \"center\",\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: spacing[4],\n },\n\n logoRightContent: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n\n logoRightLogoContainer: {\n flexShrink: 0,\n height: 48,\n marginLeft: spacing[4],\n width: 48,\n },\n minimalContainer: {\n alignItems: \"center\",\n borderBottomColor: c.primary,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[1],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: spacing[3],\n },\n minimalLeft: {\n flex: 1,\n },\n minimalRight: {\n alignItems: \"flex-end\",\n },\n\n rightSubText: {\n color: c.mutedForeground,\n fontFamily: body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginTop: spacing[1],\n textAlign: \"right\",\n },\n rightText: {\n color: c.foreground,\n fontFamily: body.fontFamily,\n fontSize: body.fontSize,\n fontWeight: fontWeights.medium,\n textAlign: \"right\",\n },\n simpleContainer: {\n alignItems: \"flex-start\",\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: spacing[4],\n },\n\n simpleLeft: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n simpleRight: {\n alignItems: \"flex-end\",\n display: \"flex\",\n flexDirection: \"column\",\n },\n\n subtitle: {\n color: c.mutedForeground,\n fontFamily: body.fontFamily,\n fontSize: body.fontSize,\n lineHeight: body.lineHeight,\n marginTop: spacing[1],\n },\n subtitleBranded: {\n color: c.primaryForeground,\n marginTop: spacing[1],\n },\n subtitleCentered: {\n textAlign: \"center\",\n },\n\n title: {\n color: c.foreground,\n fontFamily: heading.fontFamily,\n fontSize: heading.fontSize.h3,\n fontWeight: fontWeights.bold,\n lineHeight: heading.lineHeight,\n marginBottom: 0,\n },\n titleBranded: {\n color: c.primaryForeground,\n },\n titleCentered: {\n textAlign: \"center\",\n },\n\n titleMinimal: {\n fontSize: heading.fontSize.h3,\n fontWeight: fontWeights.bold,\n },\n twoColumnContainer: {\n alignItems: \"flex-start\",\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: spacing[4],\n },\n twoColumnLeft: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n twoColumnRight: {\n alignItems: \"flex-end\",\n display: \"flex\",\n flexDirection: \"column\",\n },\n });\n};\n\ntype Styles = ReturnType<typeof createPageHeaderStyles>;\n\nconst buildContainerStyles = (\n base: Style,\n mb: number,\n background: string | undefined,\n theme: PdfcnTheme,\n style: Style | undefined,\n ...extras: Style[]\n): Style[] => {\n const result: Style[] = [base, { marginBottom: mb }, ...extras];\n if (background) {\n result.push({ backgroundColor: resolveColor(background, theme.colors) });\n }\n if (style) {\n result.push(style);\n }\n return result;\n};\n\nconst buildTitleStyles = (\n base: Style[],\n titleColor: string | undefined,\n theme: PdfcnTheme\n): Style[] => {\n if (!titleColor) {\n return base;\n }\n return [...base, { color: resolveColor(titleColor, theme.colors) }];\n};\n\nconst renderBranded = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && (\n <PDFText style={[styles.subtitle, styles.subtitleBranded] as never}>\n {subtitle}\n </PDFText>\n )}\n </View>\n);\n\nconst renderCentered = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && (\n <PDFText style={[styles.subtitle, styles.subtitleCentered] as never}>\n {subtitle}\n </PDFText>\n )}\n </View>\n);\n\nconst renderLogoRight = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n logo: ReactNode | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <View style={styles.logoRightContent}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n </View>\n {logo && <View style={styles.logoRightLogoContainer}>{logo}</View>}\n </View>\n);\n\nconst renderLogoLeft = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n logo: ReactNode | undefined,\n rightText: string | undefined,\n rightSubText: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n {logo && <View style={styles.logoContainer}>{logo}</View>}\n <View style={styles.logoContent}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n </View>\n {(rightText || rightSubText) && (\n <View style={styles.simpleRight}>\n {rightText && <PDFText style={styles.rightText}>{rightText}</PDFText>}\n {rightSubText && (\n <PDFText style={styles.rightSubText}>{rightSubText}</PDFText>\n )}\n </View>\n )}\n </View>\n);\n\nconst renderTwoColumn = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n address: string | undefined,\n phone: string | undefined,\n email: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <View style={styles.twoColumnLeft}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n </View>\n {(address || phone || email) && (\n <View style={styles.twoColumnRight}>\n {address && <PDFText style={styles.contactInfo}>{address}</PDFText>}\n {phone && <PDFText style={styles.contactInfo}>{phone}</PDFText>}\n {email && <PDFText style={styles.contactInfo}>{email}</PDFText>}\n </View>\n )}\n </View>\n);\n\nconst renderMinimal = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n rightText: string | undefined,\n rightSubText: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <View style={styles.minimalLeft}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n </View>\n {(rightText || rightSubText) && (\n <View style={styles.minimalRight}>\n {rightText && <PDFText style={styles.rightText}>{rightText}</PDFText>}\n {rightSubText && (\n <PDFText style={styles.rightSubText}>{rightSubText}</PDFText>\n )}\n </View>\n )}\n </View>\n);\n\nconst renderSimple = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n rightText: string | undefined,\n rightSubText: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <View style={styles.simpleLeft}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n </View>\n {(rightText || rightSubText) && (\n <View style={styles.simpleRight}>\n {rightText && <PDFText style={styles.rightText}>{rightText}</PDFText>}\n {rightSubText && (\n <PDFText style={styles.rightSubText}>{rightSubText}</PDFText>\n )}\n </View>\n )}\n </View>\n);\n\nexport const PageHeader = ({\n title,\n subtitle,\n rightText,\n rightSubText,\n variant = \"simple\",\n background,\n titleColor,\n marginBottom,\n logo,\n address,\n phone,\n email,\n fixed = false,\n noWrap = true,\n style,\n}: PageHeaderProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createPageHeaderStyles(theme), [theme]);\n const mb = marginBottom ?? theme.spacing.sectionGap;\n\n const variantRenderers: Record<PageHeaderVariant, () => React.ReactNode> = {\n branded: () =>\n renderBranded(\n styles,\n buildContainerStyles(\n styles.brandedContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles(\n [styles.title, styles.titleBranded, styles.titleCentered],\n titleColor,\n theme\n ),\n title,\n subtitle,\n noWrap\n ),\n centered: () =>\n renderCentered(\n styles,\n buildContainerStyles(\n styles.centeredContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles(\n [styles.title, styles.titleCentered],\n titleColor,\n theme\n ),\n title,\n subtitle,\n noWrap\n ),\n \"logo-left\": () =>\n renderLogoLeft(\n styles,\n buildContainerStyles(\n styles.logoLeftContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles([styles.title], titleColor, theme),\n title,\n subtitle,\n logo,\n rightText,\n rightSubText,\n noWrap\n ),\n \"logo-right\": () =>\n renderLogoRight(\n styles,\n buildContainerStyles(\n styles.logoRightContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles([styles.title], titleColor, theme),\n title,\n subtitle,\n logo,\n noWrap\n ),\n minimal: () =>\n renderMinimal(\n styles,\n buildContainerStyles(\n styles.minimalContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles(\n [styles.title, styles.titleMinimal],\n titleColor,\n theme\n ),\n title,\n subtitle,\n rightText,\n rightSubText,\n noWrap\n ),\n simple: () =>\n renderSimple(\n styles,\n buildContainerStyles(\n styles.simpleContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles([styles.title], titleColor, theme),\n title,\n subtitle,\n rightText,\n rightSubText,\n noWrap\n ),\n \"two-column\": () =>\n renderTwoColumn(\n styles,\n buildContainerStyles(\n styles.twoColumnContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles([styles.title], titleColor, theme),\n title,\n subtitle,\n address,\n phone,\n email,\n noWrap\n ),\n };\n\n return wrapFixed(fixed, variantRenderers[variant]() as React.ReactElement);\n};\n",
"type": "registry:component",
"target": "components/pdf/page-header/page-header.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/page-number.json b/apps/web/public/r/forme/page-number.json
index 2a15e30..41d8895 100644
--- a/apps/web/public/r/forme/page-number.json
+++ b/apps/web/public/r/forme/page-number.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/forme/components/page-number/page-number.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport {\r\n Text,\r\n StyleSheet,\r\n View,\r\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type PageNumberAlign = \"left\" | \"center\" | \"right\";\r\nexport type PageNumberSize = \"xs\" | \"sm\" | \"md\";\r\n\r\n/**\r\n * Auto page number rendered with a configurable format string at a or inline position.\r\n * Props - `format` | `align` | `size` | `fixed` | `muted` | `style`\r\n * @see {@link PageNumberProps}\r\n */\r\nexport interface PageNumberProps extends Omit<PDFComponentProps, \"children\"> {\r\n /**\r\n * Format string — use `{page}` for current page and `{total}` for total page count.\r\n * @default 'Page {page} of {total}'\r\n */\r\n format?: string;\r\n /**\r\n * @default 'center'\r\n */\r\n align?: PageNumberAlign;\r\n /**\r\n * @default 'sm'\r\n */\r\n size?: PageNumberSize;\r\n /**\r\n * @default false\r\n */\r\n fixed?: boolean;\r\n /**\r\n * @default true\r\n */\r\n muted?: boolean;\r\n children?: never;\r\n}\r\n\r\nconst createPageNumberStyles = (t: PdfcnTheme) => {\r\n const { typography, colors, primitives } = t;\r\n return StyleSheet.create({\r\n alignCenter: { textAlign: \"center\" },\r\n alignLeft: { textAlign: \"left\" },\r\n alignRight: { textAlign: \"right\" },\r\n colorForeground: { color: colors.foreground },\r\n colorMuted: { color: colors.mutedForeground },\r\n container: { width: \"100%\" },\r\n sizeMd: { fontSize: primitives.typography.base },\r\n sizeSm: { fontSize: primitives.typography.sm },\r\n sizeXs: { fontSize: primitives.typography.xs },\r\n text: { fontFamily: typography.body.fontFamily },\r\n });\r\n};\r\n\r\nexport const PageNumber = ({\r\n format = \"Page {page} of {total}\",\r\n align = \"center\",\r\n size = \"sm\",\r\n muted = true,\r\n style,\r\n}: PageNumberProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createPageNumberStyles(theme), [theme]);\r\n const alignMap = {\r\n center: styles.alignCenter,\r\n left: styles.alignLeft,\r\n right: styles.alignRight,\r\n } as Record<PageNumberAlign, Style>;\r\n const sizeMap = {\r\n md: styles.sizeMd,\r\n sm: styles.sizeSm,\r\n xs: styles.sizeXs,\r\n } as Record<PageNumberSize, Style>;\r\n const textStyles: Style[] = [\r\n styles.text,\r\n alignMap[align],\r\n sizeMap[size],\r\n muted ? styles.colorMuted : styles.colorForeground,\r\n ];\r\n if (style) {\r\n textStyles.push(...[style].flat());\r\n }\r\n return (\r\n <View style={styles.container}>\r\n <Text style={textStyles as never}>\r\n {format\r\n .replace(\"{page}\", \"{{pageNumber}}\")\r\n .replace(\"{total}\", \"{{totalPages}}\")}\r\n </Text>\r\n </View>\r\n );\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Text,\n StyleSheet,\n View,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type PageNumberAlign = \"left\" | \"center\" | \"right\";\nexport type PageNumberSize = \"xs\" | \"sm\" | \"md\";\n\n/**\n * Auto page number rendered with a configurable format string at a or inline position.\n * Props - `format` | `align` | `size` | `fixed` | `muted` | `style`\n * @see {@link PageNumberProps}\n */\nexport interface PageNumberProps extends Omit<PDFComponentProps, \"children\"> {\n /**\n * Format string — use `{page}` for current page and `{total}` for total page count.\n * @default 'Page {page} of {total}'\n */\n format?: string;\n /**\n * @default 'center'\n */\n align?: PageNumberAlign;\n /**\n * @default 'sm'\n */\n size?: PageNumberSize;\n /**\n * @default false\n */\n fixed?: boolean;\n /**\n * @default true\n */\n muted?: boolean;\n children?: never;\n}\n\nconst createPageNumberStyles = (t: PdfcnTheme) => {\n const { typography, colors, primitives } = t;\n return StyleSheet.create({\n alignCenter: { textAlign: \"center\" },\n alignLeft: { textAlign: \"left\" },\n alignRight: { textAlign: \"right\" },\n colorForeground: { color: colors.foreground },\n colorMuted: { color: colors.mutedForeground },\n container: { width: \"100%\" },\n sizeMd: { fontSize: primitives.typography.base },\n sizeSm: { fontSize: primitives.typography.sm },\n sizeXs: { fontSize: primitives.typography.xs },\n text: { fontFamily: typography.body.fontFamily },\n });\n};\n\nexport const PageNumber = ({\n format = \"Page {page} of {total}\",\n align = \"center\",\n size = \"sm\",\n muted = true,\n style,\n}: PageNumberProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createPageNumberStyles(theme), [theme]);\n const alignMap = {\n center: styles.alignCenter,\n left: styles.alignLeft,\n right: styles.alignRight,\n } as Record<PageNumberAlign, Style>;\n const sizeMap = {\n md: styles.sizeMd,\n sm: styles.sizeSm,\n xs: styles.sizeXs,\n } as Record<PageNumberSize, Style>;\n const textStyles: Style[] = [\n styles.text,\n alignMap[align],\n sizeMap[size],\n muted ? styles.colorMuted : styles.colorForeground,\n ];\n if (style) {\n textStyles.push(...[style].flat());\n }\n return (\n <View style={styles.container}>\n <Text style={textStyles as never}>\n {format\n .replace(\"{page}\", \"{{pageNumber}}\")\n .replace(\"{total}\", \"{{totalPages}}\")}\n </Text>\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/page-number/page-number.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/pdf-image.json b/apps/web/public/r/forme/pdf-image.json
index 7b9bdc8..53d6dc6 100644
--- a/apps/web/public/r/forme/pdf-image.json
+++ b/apps/web/public/r/forme/pdf-image.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/forme/components/pdf-image/pdf-image.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport {\r\n Image,\r\n Text as PDFText,\r\n StyleSheet,\r\n View,\r\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\n/** HTTP method used when fetching the image from a URL. */\r\nexport type PdfImageHTTPMethod =\r\n | \"GET\"\r\n | \"HEAD\"\r\n | \"POST\"\r\n | \"PUT\"\r\n | \"DELETE\"\r\n | \"PATCH\";\r\n\r\nexport type PdfImageSrc =\r\n | string\r\n | {\r\n uri: string;\r\n method?: PdfImageHTTPMethod;\r\n headers?: Record<string, string>;\r\n body?: string;\r\n };\r\n\r\nexport type PdfImageFit = \"cover\" | \"contain\" | \"fill\" | \"none\";\r\n\r\nexport type PdfImageVariant =\r\n | \"default\"\r\n | \"full-width\"\r\n | \"thumbnail\"\r\n | \"avatar\"\r\n | \"cover\"\r\n | \"bordered\"\r\n | \"rounded\";\r\n\r\n/**\r\n * Image element with layout presets, caption, and aspect ratio support.\r\n * Props - `src` | `variant` | `width` | `height` | `fit` | `position` | `caption` | `aspectRatio` | `borderRadius` | `noWrap` | `style`\r\n * @see {@link PdfImageProps}\r\n */\r\nexport interface PdfImageProps {\r\n src: PdfImageSrc;\r\n /**\r\n * @default 'default'\r\n */\r\n variant?: PdfImageVariant;\r\n width?: number | string;\r\n height?: number | string;\r\n fit?: PdfImageFit;\r\n /**\r\n * @default '50% 50%'\r\n */\r\n position?: string;\r\n caption?: string;\r\n aspectRatio?: number;\r\n borderRadius?: number;\r\n /**\r\n * @default true\r\n */\r\n noWrap?: boolean;\r\n style?: Style;\r\n}\r\n\r\ninterface VariantDefaults {\r\n width?: number | string;\r\n height?: number | string;\r\n fit: PdfImageFit;\r\n borderRadius?: number;\r\n}\r\n\r\nconst VARIANT_DEFAULTS: Record<PdfImageVariant, VariantDefaults> = {\r\n avatar: { borderRadius: 999, fit: \"cover\", height: 48, width: 48 },\r\n bordered: { fit: \"contain\", width: \"100%\" },\r\n cover: { fit: \"cover\", height: 160, width: \"100%\" },\r\n default: { fit: \"contain\" },\r\n \"full-width\": { fit: \"cover\", width: \"100%\" },\r\n rounded: { borderRadius: 8, fit: \"contain\", width: 200 },\r\n thumbnail: { fit: \"cover\", height: 80, width: 80 },\r\n};\r\n\r\nconst UNSUPPORTED_FORMATS = new Set([\"webp\", \"avif\", \"heic\", \"heif\", \"ico\"]);\r\n\r\nconst detectFormat = (src: PdfImageSrc): string | null => {\r\n if (typeof src !== \"string\") {\r\n return null;\r\n }\r\n const dataMatch = src.match(/^data:image\\/([a-zA-Z0-9+.-]+)/);\r\n if (dataMatch) {\r\n return dataMatch[1].toLowerCase();\r\n }\r\n return src.split(\"?\")[0].split(\".\").pop()?.toLowerCase() ?? null;\r\n};\r\n\r\nconst warnIfUnsupported = (src: PdfImageSrc): void => {\r\n const fmt = detectFormat(src);\r\n if (fmt && UNSUPPORTED_FORMATS.has(fmt)) {\r\n console.warn(\r\n `[PdfImage] Unsupported format \"${fmt}\" detected. react-pdf supports: JPEG, PNG, GIF (first frame), BMP, SVG. Convert to PNG or JPEG before use.`\r\n );\r\n }\r\n};\r\n\r\nconst createImageStyles = (t: PdfcnTheme) => {\r\n const { spacing } = t.primitives;\r\n return StyleSheet.create({\r\n caption: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n marginTop: spacing[1],\r\n textAlign: \"center\",\r\n },\r\n container: { flexDirection: \"column\" },\r\n image: {},\r\n imageBordered: {\r\n borderColor: t.colors.border,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n },\r\n });\r\n};\r\n\r\nexport const PdfImage = ({\r\n src,\r\n variant = \"default\",\r\n width,\r\n height,\r\n fit,\r\n position = \"50% 50%\",\r\n caption,\r\n aspectRatio,\r\n borderRadius,\r\n noWrap = true,\r\n style,\r\n}: PdfImageProps) => {\r\n warnIfUnsupported(src);\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createImageStyles(theme), [theme]);\r\n const defaults = VARIANT_DEFAULTS[variant];\r\n\r\n const resolvedWidth = width ?? defaults.width;\r\n const resolvedHeight: number | string | undefined = (() => {\r\n if (height !== undefined) {\r\n return height;\r\n }\r\n if (defaults.height !== undefined) {\r\n return defaults.height;\r\n }\r\n if (aspectRatio !== undefined && typeof resolvedWidth === \"number\") {\r\n return resolvedWidth / aspectRatio;\r\n }\r\n })();\r\n\r\n const resolvedFit = fit ?? defaults.fit;\r\n const resolvedRadius = borderRadius ?? defaults.borderRadius;\r\n\r\n const imageStyles: Style[] = [styles.image];\r\n if (resolvedWidth !== undefined) {\r\n imageStyles.push({ width: resolvedWidth } as Style);\r\n }\r\n if (resolvedHeight !== undefined) {\r\n imageStyles.push({ height: resolvedHeight } as Style);\r\n }\r\n imageStyles.push({\r\n objectFit: resolvedFit,\r\n objectPosition: position,\r\n } as Style);\r\n if (resolvedRadius !== undefined) {\r\n imageStyles.push({ borderRadius: resolvedRadius } as Style);\r\n }\r\n if (variant === \"bordered\") {\r\n imageStyles.push(styles.imageBordered);\r\n }\r\n if (style) {\r\n imageStyles.push(style);\r\n }\r\n\r\n const content = (\r\n <View style={styles.container}>\r\n <Image src={src as never} style={imageStyles as never} />\r\n {caption ? <PDFText style={styles.caption}>{caption}</PDFText> : null}\r\n </View>\r\n );\r\n\r\n return noWrap ? <View wrap={false}>{content}</View> : content;\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Image,\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\n/** HTTP method used when fetching the image from a URL. */\nexport type PdfImageHTTPMethod =\n | \"GET\"\n | \"HEAD\"\n | \"POST\"\n | \"PUT\"\n | \"DELETE\"\n | \"PATCH\";\n\nexport type PdfImageSrc =\n | string\n | {\n uri: string;\n method?: PdfImageHTTPMethod;\n headers?: Record<string, string>;\n body?: string;\n };\n\nexport type PdfImageFit = \"cover\" | \"contain\" | \"fill\" | \"none\";\n\nexport type PdfImageVariant =\n | \"default\"\n | \"full-width\"\n | \"thumbnail\"\n | \"avatar\"\n | \"cover\"\n | \"bordered\"\n | \"rounded\";\n\n/**\n * Image element with layout presets, caption, and aspect ratio support.\n * Props - `src` | `variant` | `width` | `height` | `fit` | `position` | `caption` | `aspectRatio` | `borderRadius` | `noWrap` | `style`\n * @see {@link PdfImageProps}\n */\nexport interface PdfImageProps {\n src: PdfImageSrc;\n /**\n * @default 'default'\n */\n variant?: PdfImageVariant;\n width?: number | string;\n height?: number | string;\n fit?: PdfImageFit;\n /**\n * @default '50% 50%'\n */\n position?: string;\n caption?: string;\n aspectRatio?: number;\n borderRadius?: number;\n /**\n * @default true\n */\n noWrap?: boolean;\n style?: Style;\n}\n\ninterface VariantDefaults {\n width?: number | string;\n height?: number | string;\n fit: PdfImageFit;\n borderRadius?: number;\n}\n\nconst VARIANT_DEFAULTS: Record<PdfImageVariant, VariantDefaults> = {\n avatar: { borderRadius: 999, fit: \"cover\", height: 48, width: 48 },\n bordered: { fit: \"contain\", width: \"100%\" },\n cover: { fit: \"cover\", height: 160, width: \"100%\" },\n default: { fit: \"contain\" },\n \"full-width\": { fit: \"cover\", width: \"100%\" },\n rounded: { borderRadius: 8, fit: \"contain\", width: 200 },\n thumbnail: { fit: \"cover\", height: 80, width: 80 },\n};\n\nconst UNSUPPORTED_FORMATS = new Set([\"webp\", \"avif\", \"heic\", \"heif\", \"ico\"]);\n\nconst detectFormat = (src: PdfImageSrc): string | null => {\n if (typeof src !== \"string\") {\n return null;\n }\n const dataMatch = src.match(/^data:image\\/([a-zA-Z0-9+.-]+)/);\n if (dataMatch) {\n return dataMatch[1].toLowerCase();\n }\n return src.split(\"?\")[0].split(\".\").pop()?.toLowerCase() ?? null;\n};\n\nconst warnIfUnsupported = (src: PdfImageSrc): void => {\n const fmt = detectFormat(src);\n if (fmt && UNSUPPORTED_FORMATS.has(fmt)) {\n console.warn(\n `[PdfImage] Unsupported format \"${fmt}\" detected. react-pdf supports: JPEG, PNG, GIF (first frame), BMP, SVG. Convert to PNG or JPEG before use.`\n );\n }\n};\n\nconst createImageStyles = (t: PdfcnTheme) => {\n const { spacing } = t.primitives;\n return StyleSheet.create({\n caption: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginTop: spacing[1],\n textAlign: \"center\",\n },\n container: { flexDirection: \"column\" },\n image: {},\n imageBordered: {\n borderColor: t.colors.border,\n borderStyle: \"solid\",\n borderWidth: 1,\n },\n });\n};\n\nexport const PdfImage = ({\n src,\n variant = \"default\",\n width,\n height,\n fit,\n position = \"50% 50%\",\n caption,\n aspectRatio,\n borderRadius,\n noWrap = true,\n style,\n}: PdfImageProps) => {\n warnIfUnsupported(src);\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createImageStyles(theme), [theme]);\n const defaults = VARIANT_DEFAULTS[variant];\n\n const resolvedWidth = width ?? defaults.width;\n const resolvedHeight: number | string | undefined = (() => {\n if (height !== undefined) {\n return height;\n }\n if (defaults.height !== undefined) {\n return defaults.height;\n }\n if (aspectRatio !== undefined && typeof resolvedWidth === \"number\") {\n return resolvedWidth / aspectRatio;\n }\n })();\n\n const resolvedFit = fit ?? defaults.fit;\n const resolvedRadius = borderRadius ?? defaults.borderRadius;\n\n const imageStyles: Style[] = [styles.image];\n if (resolvedWidth !== undefined) {\n imageStyles.push({ width: resolvedWidth } as Style);\n }\n if (resolvedHeight !== undefined) {\n imageStyles.push({ height: resolvedHeight } as Style);\n }\n imageStyles.push({\n objectFit: resolvedFit,\n objectPosition: position,\n } as Style);\n if (resolvedRadius !== undefined) {\n imageStyles.push({ borderRadius: resolvedRadius } as Style);\n }\n if (variant === \"bordered\") {\n imageStyles.push(styles.imageBordered);\n }\n if (style) {\n imageStyles.push(style);\n }\n\n const content = (\n <View style={styles.container}>\n <Image src={src as never} style={imageStyles as never} />\n {caption ? <PDFText style={styles.caption}>{caption}</PDFText> : null}\n </View>\n );\n\n return noWrap ? <View wrap={false}>{content}</View> : content;\n};\n",
"type": "registry:component",
"target": "components/pdf/pdf-image/pdf-image.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/press-release.json b/apps/web/public/r/forme/press-release.json
index ca51a6d..6e589ac 100644
--- a/apps/web/public/r/forme/press-release.json
+++ b/apps/web/public/r/forme/press-release.json
@@ -18,7 +18,7 @@
"files": [
{
"path": "registry/bases/forme/blocks/press-release/press-release.tsx",
- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { PageFooter } from \"@/registry/bases/forme/components/page-footer/page-footer\";\nimport { PageHeader } from \"@/registry/bases/forme/components/page-header/page-header\";\nimport { PdfImage } from \"@/registry/bases/forme/components/pdf-image/pdf-image\";\nimport { Section } from \"@/registry/bases/forme/components/section/section\";\nimport { Text } from \"@/registry/bases/forme/components/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type { PressReleaseProps } from \"./press-release.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: PressReleaseProps = {\n accentColor: \"#1e40af\",\n address: \"123 Market St, San Francisco, CA 94103\",\n body: [\n \"Acme Corp today announced the launch of pdfcn, an open-source React component library for generating professional PDF documents.\",\n \"pdfcn is designed to work seamlessly with shadcn/ui and follows the same registry-based distribution model, letting developers add print-ready document blocks with a single CLI command.\",\n ],\n boilerplate:\n \"Acme Corp is a leading provider of developer tools and open-source software.\",\n companyName: \"Acme Corp\",\n date: \"September 10, 2026\",\n dateline: { city: \"San Francisco\", state: \"CA\" },\n headline: \"Acme Corp Launches Revolutionary PDF Toolkit for Developers\",\n mediaContact: {\n email: \"[email protected]\",\n name: \"Press Team\",\n phone: \"(555) 123-4567\",\n },\n quotes: [\n {\n author: \"Jane Doe\",\n text: \"We built pdfcn because generating PDFs in React was unnecessarily painful. Now it feels like writing any other component.\",\n title: \"CTO, Acme Corp\",\n },\n ],\n socialLinks: [\n { platform: \"GitHub\", url: \"https://github.com/acme\" },\n { platform: \"X\", url: \"https://x.com/acme\" },\n ],\n subheadline:\n \"New open-source library makes generating professional PDFs in React effortless\",\n};\n\nconst PressReleaseContent = ({ data }: { data: PressReleaseProps }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n columnHeading: {\n fontSize: 9,\n fontWeight: \"bold\",\n marginBottom: 2,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n });\n\n return (\n <Document title={`Press Release — ${data.companyName}`}>\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\n <PageFooter\n leftText={data.address ?? data.companyName}\n rightText={\n data.socialLinks?.length\n ? data.socialLinks.map((link) => link.platform).join(\" · \")\n : undefined\n }\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"logo-left\"\n logo={\n data.companyLogo ? (\n <PdfImage src={data.companyLogo} style={{ margin: 0 }} />\n ) : undefined\n }\n title={data.companyName}\n rightText={data.date}\n style={{ marginBottom: 0 }}\n />\n <Section spacing=\"none\">\n <Text\n variant=\"xs\"\n weight=\"bold\"\n transform=\"uppercase\"\n color={data.accentColor ?? \"mutedForeground\"}\n noMargin\n >\n For Immediate Release\n </Text>\n <Text variant=\"2xl\" weight=\"bold\" noMargin>\n {data.headline}\n </Text>\n {data.subheadline && (\n <Text variant=\"lg\" color=\"mutedForeground\" noMargin>\n {data.subheadline}\n </Text>\n )}\n </Section>\n <Section spacing=\"sm\">\n <Text variant=\"sm\" weight=\"semibold\" transform=\"uppercase\" noMargin>\n {`${data.dateline.city}, ${data.dateline.state} — ${data.date}`}\n </Text>\n {data.body.map((paragraph) => (\n <Text key={paragraph.slice(0, 24)} variant=\"sm\">\n {paragraph}\n </Text>\n ))}\n </Section>\n {data.quotes?.map((quote) => (\n <Section\n key={quote.author}\n spacing=\"sm\"\n variant=\"callout\"\n accentColor={data.accentColor}\n >\n <Text variant=\"base\" italic noMargin>\n {`“${quote.text}”`}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {`— ${quote.author}, ${quote.title}`}\n </Text>\n </Section>\n ))}\n <Section spacing=\"sm\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n {`About ${data.companyName}`}\n </Text>\n <Text variant=\"sm\" noMargin>\n {data.boilerplate}\n </Text>\n </Section>\n <Section spacing=\"none\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Media Contact\n </Text>\n <Text noMargin variant=\"xs\">\n {data.mediaContact.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.mediaContact.email}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.mediaContact.phone}\n </Text>\n {data.mediaContact.website && (\n <Text noMargin variant=\"xs\">\n {data.mediaContact.website}\n </Text>\n )}\n </Section>\n <Text align=\"center\" variant=\"sm\" weight=\"medium\" noMargin>\n ###\n </Text>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const PressReleaseDocument = ({\n theme,\n data,\n ...props\n}: {\n theme?: PdfcnTheme;\n data?: PressReleaseProps;\n} & Partial<PressReleaseProps>) => (\n <PdfcnThemeProvider theme={theme}>\n <PressReleaseContent data={{ ...sampleData, ...data, ...props }} />\n </PdfcnThemeProvider>\n);\n",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { PdfImage } from \"@/components/pdf/pdf-image/pdf-image\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { PressReleaseProps } from \"./press-release.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: PressReleaseProps = {\n accentColor: \"#1e40af\",\n address: \"123 Market St, San Francisco, CA 94103\",\n body: [\n \"Acme Corp today announced the launch of pdfcn, an open-source React component library for generating professional PDF documents.\",\n \"pdfcn is designed to work seamlessly with shadcn/ui and follows the same registry-based distribution model, letting developers add print-ready document blocks with a single CLI command.\",\n ],\n boilerplate:\n \"Acme Corp is a leading provider of developer tools and open-source software.\",\n companyName: \"Acme Corp\",\n date: \"September 10, 2026\",\n dateline: { city: \"San Francisco\", state: \"CA\" },\n headline: \"Acme Corp Launches Revolutionary PDF Toolkit for Developers\",\n mediaContact: {\n email: \"[email protected]\",\n name: \"Press Team\",\n phone: \"(555) 123-4567\",\n },\n quotes: [\n {\n author: \"Jane Doe\",\n text: \"We built pdfcn because generating PDFs in React was unnecessarily painful. Now it feels like writing any other component.\",\n title: \"CTO, Acme Corp\",\n },\n ],\n socialLinks: [\n { platform: \"GitHub\", url: \"https://github.com/acme\" },\n { platform: \"X\", url: \"https://x.com/acme\" },\n ],\n subheadline:\n \"New open-source library makes generating professional PDFs in React effortless\",\n};\n\nconst PressReleaseContent = ({ data }: { data: PressReleaseProps }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n columnHeading: {\n fontSize: 9,\n fontWeight: \"bold\",\n marginBottom: 2,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n });\n\n return (\n <Document title={`Press Release — ${data.companyName}`}>\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\n <PageFooter\n leftText={data.address ?? data.companyName}\n rightText={\n data.socialLinks?.length\n ? data.socialLinks.map((link) => link.platform).join(\" · \")\n : undefined\n }\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"logo-left\"\n logo={\n data.companyLogo ? (\n <PdfImage src={data.companyLogo} style={{ margin: 0 }} />\n ) : undefined\n }\n title={data.companyName}\n rightText={data.date}\n style={{ marginBottom: 0 }}\n />\n <Section spacing=\"none\">\n <Text\n variant=\"xs\"\n weight=\"bold\"\n transform=\"uppercase\"\n color={data.accentColor ?? \"mutedForeground\"}\n noMargin\n >\n For Immediate Release\n </Text>\n <Text variant=\"2xl\" weight=\"bold\" noMargin>\n {data.headline}\n </Text>\n {data.subheadline && (\n <Text variant=\"lg\" color=\"mutedForeground\" noMargin>\n {data.subheadline}\n </Text>\n )}\n </Section>\n <Section spacing=\"sm\">\n <Text variant=\"sm\" weight=\"semibold\" transform=\"uppercase\" noMargin>\n {`${data.dateline.city}, ${data.dateline.state} — ${data.date}`}\n </Text>\n {data.body.map((paragraph) => (\n <Text key={paragraph.slice(0, 24)} variant=\"sm\">\n {paragraph}\n </Text>\n ))}\n </Section>\n {data.quotes?.map((quote) => (\n <Section\n key={quote.author}\n spacing=\"sm\"\n variant=\"callout\"\n accentColor={data.accentColor}\n >\n <Text variant=\"base\" italic noMargin>\n {`“${quote.text}”`}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {`— ${quote.author}, ${quote.title}`}\n </Text>\n </Section>\n ))}\n <Section spacing=\"sm\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n {`About ${data.companyName}`}\n </Text>\n <Text variant=\"sm\" noMargin>\n {data.boilerplate}\n </Text>\n </Section>\n <Section spacing=\"none\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Media Contact\n </Text>\n <Text noMargin variant=\"xs\">\n {data.mediaContact.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.mediaContact.email}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.mediaContact.phone}\n </Text>\n {data.mediaContact.website && (\n <Text noMargin variant=\"xs\">\n {data.mediaContact.website}\n </Text>\n )}\n </Section>\n <Text align=\"center\" variant=\"sm\" weight=\"medium\" noMargin>\n ###\n </Text>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const PressReleaseDocument = ({\n theme,\n data,\n ...props\n}: {\n theme?: PdfcnTheme;\n data?: PressReleaseProps;\n} & Partial<PressReleaseProps>) => (\n <PdfcnThemeProvider theme={theme}>\n <PressReleaseContent data={{ ...sampleData, ...data, ...props }} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/press-release/press-release.tsx"
},
@@ -30,4 +30,4 @@
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/qrcode.json b/apps/web/public/r/forme/qrcode.json
index 08c0863..4257b60 100644
--- a/apps/web/public/r/forme/qrcode.json
+++ b/apps/web/public/r/forme/qrcode.json
@@ -14,10 +14,10 @@
"files": [
{
"path": "registry/bases/forme/components/qrcode/qrcode.tsx",
- "content": "import QRCode from \"qrcode\";\r\n\r\nimport {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport {\r\n Text as PDFText,\r\n StyleSheet,\r\n View,\r\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport { Rect, Svg } from \"@/registry/bases/forme/lib/pdf-svg\";\r\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type QRCodeErrorLevel = \"L\" | \"M\" | \"Q\" | \"H\";\r\n\r\n/**\r\n * QR code rendered as an SVG grid for use in PDF documents.\r\n * Props - `value` | `size` | `color` | `backgroundColor` | `errorLevel` | `margin` | `caption` | `style`\r\n * @see {@link PdfQRCodeProps}\r\n */\r\nexport interface PdfQRCodeProps extends Omit<PDFComponentProps, \"children\"> {\r\n value: string;\r\n size?: number;\r\n color?: string;\r\n backgroundColor?: string;\r\n errorLevel?: QRCodeErrorLevel;\r\n margin?: number;\r\n caption?: string;\r\n children?: never;\r\n}\r\n\r\nconst createQRCodeStyles = (t: PdfcnTheme) => {\r\n const { spacing } = t.primitives;\r\n return StyleSheet.create({\r\n caption: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n marginTop: spacing[1],\r\n textAlign: \"center\",\r\n },\r\n container: { alignItems: \"center\" },\r\n });\r\n};\r\n\r\nconst generateQRMatrix = (\r\n value: string,\r\n errorLevel: QRCodeErrorLevel,\r\n margin: number\r\n): boolean[][] => {\r\n const qr = QRCode.create(value, { errorCorrectionLevel: errorLevel });\r\n const { size, data } = qr.modules;\r\n const totalSize = size + margin * 2;\r\n const matrix: boolean[][] = [];\r\n for (let row = 0; row < totalSize; row += 1) {\r\n const rowData: boolean[] = [];\r\n for (let col = 0; col < totalSize; col += 1) {\r\n const isInMargin =\r\n row < margin ||\r\n row >= size + margin ||\r\n col < margin ||\r\n col >= size + margin;\r\n if (isInMargin) {\r\n rowData.push(false);\r\n } else {\r\n rowData.push(data[(row - margin) * size + (col - margin)] === 1);\r\n }\r\n }\r\n matrix.push(rowData);\r\n }\r\n return matrix;\r\n};\r\n\r\nexport const PdfQRCode = ({\r\n value,\r\n size = 100,\r\n color = \"#000000\",\r\n backgroundColor = \"#ffffff\",\r\n errorLevel = \"M\",\r\n margin = 2,\r\n caption,\r\n style,\r\n}: PdfQRCodeProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createQRCodeStyles(theme), [theme]);\r\n const matrix = useSafeMemo(\r\n () => generateQRMatrix(value, errorLevel, margin),\r\n [value, errorLevel, margin]\r\n );\r\n const moduleSize = size / matrix.length;\r\n const resolvedColor = resolveColor(color, theme.colors);\r\n const resolvedBgColor =\r\n backgroundColor === \"transparent\"\r\n ? undefined\r\n : resolveColor(backgroundColor, theme.colors);\r\n const containerStyles: Style[] = [styles.container];\r\n if (style) {\r\n containerStyles.push(...[style].flat());\r\n }\r\n\r\n return (\r\n <View style={containerStyles as never}>\r\n <Svg width={size} height={size} viewBox={`0 0 ${size} ${size}`}>\r\n {resolvedBgColor !== undefined && (\r\n <Rect x={0} y={0} width={size} height={size} fill={resolvedBgColor} />\r\n )}\r\n {matrix\r\n .flatMap((row, y) =>\r\n row\r\n .map((isDark, x) => (isDark ? { x, y } : null))\r\n .filter((pos): pos is { x: number; y: number } => pos !== null)\r\n )\r\n .map((pos) => (\r\n <Rect\r\n key={`qr-${pos.y}-${pos.x}`}\r\n x={pos.x * moduleSize}\r\n y={pos.y * moduleSize}\r\n width={moduleSize}\r\n height={moduleSize}\r\n fill={resolvedColor}\r\n />\r\n ))}\r\n </Svg>\r\n {caption && <PDFText style={styles.caption}>{caption}</PDFText>}\r\n </View>\r\n );\r\n};\r\n",
+ "content": "import QRCode from \"qrcode\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { Rect, Svg } from \"@/lib/pdf-svg\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type QRCodeErrorLevel = \"L\" | \"M\" | \"Q\" | \"H\";\n\n/**\n * QR code rendered as an SVG grid for use in PDF documents.\n * Props - `value` | `size` | `color` | `backgroundColor` | `errorLevel` | `margin` | `caption` | `style`\n * @see {@link PdfQRCodeProps}\n */\nexport interface PdfQRCodeProps extends Omit<PDFComponentProps, \"children\"> {\n value: string;\n size?: number;\n color?: string;\n backgroundColor?: string;\n errorLevel?: QRCodeErrorLevel;\n margin?: number;\n caption?: string;\n children?: never;\n}\n\nconst createQRCodeStyles = (t: PdfcnTheme) => {\n const { spacing } = t.primitives;\n return StyleSheet.create({\n caption: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginTop: spacing[1],\n textAlign: \"center\",\n },\n container: { alignItems: \"center\" },\n });\n};\n\nconst generateQRMatrix = (\n value: string,\n errorLevel: QRCodeErrorLevel,\n margin: number\n): boolean[][] => {\n const qr = QRCode.create(value, { errorCorrectionLevel: errorLevel });\n const { size, data } = qr.modules;\n const totalSize = size + margin * 2;\n const matrix: boolean[][] = [];\n for (let row = 0; row < totalSize; row += 1) {\n const rowData: boolean[] = [];\n for (let col = 0; col < totalSize; col += 1) {\n const isInMargin =\n row < margin ||\n row >= size + margin ||\n col < margin ||\n col >= size + margin;\n if (isInMargin) {\n rowData.push(false);\n } else {\n rowData.push(data[(row - margin) * size + (col - margin)] === 1);\n }\n }\n matrix.push(rowData);\n }\n return matrix;\n};\n\nexport const PdfQRCode = ({\n value,\n size = 100,\n color = \"#000000\",\n backgroundColor = \"#ffffff\",\n errorLevel = \"M\",\n margin = 2,\n caption,\n style,\n}: PdfQRCodeProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createQRCodeStyles(theme), [theme]);\n const matrix = useSafeMemo(\n () => generateQRMatrix(value, errorLevel, margin),\n [value, errorLevel, margin]\n );\n const moduleSize = size / matrix.length;\n const resolvedColor = resolveColor(color, theme.colors);\n const resolvedBgColor =\n backgroundColor === \"transparent\"\n ? undefined\n : resolveColor(backgroundColor, theme.colors);\n const containerStyles: Style[] = [styles.container];\n if (style) {\n containerStyles.push(...[style].flat());\n }\n\n return (\n <View style={containerStyles as never}>\n <Svg width={size} height={size} viewBox={`0 0 ${size} ${size}`}>\n {resolvedBgColor !== undefined && (\n <Rect x={0} y={0} width={size} height={size} fill={resolvedBgColor} />\n )}\n {matrix\n .flatMap((row, y) =>\n row\n .map((isDark, x) => (isDark ? { x, y } : null))\n .filter((pos): pos is { x: number; y: number } => pos !== null)\n )\n .map((pos) => (\n <Rect\n key={`qr-${pos.y}-${pos.x}`}\n x={pos.x * moduleSize}\n y={pos.y * moduleSize}\n width={moduleSize}\n height={moduleSize}\n fill={resolvedColor}\n />\n ))}\n </Svg>\n {caption && <PDFText style={styles.caption}>{caption}</PDFText>}\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/qrcode/qrcode.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/report-financial.json b/apps/web/public/r/forme/report-financial.json
index db6c57f..1241522 100644
--- a/apps/web/public/r/forme/report-financial.json
+++ b/apps/web/public/r/forme/report-financial.json
@@ -14,6 +14,7 @@
"@pdfcn/forme/key-value",
"@pdfcn/forme/page-footer",
"@pdfcn/forme/page-header",
+ "@pdfcn/forme/page-number",
"@pdfcn/forme/graph",
"@pdfcn/forme/list",
"@pdfcn/forme/section",
@@ -22,22 +23,22 @@
"files": [
{
"path": "registry/bases/forme/blocks/report-financial/report-financial.tsx",
- "content": "import { ReportTemplateFrame } from \"./report-layout\";\r\nimport type { ReportTemplateProps } from \"./report-layout\";\r\nimport type { BaseReportData } from \"./report.types\";\r\n\r\nconst sampleFinancialData: BaseReportData = {\r\n author: \"Finance Ops\",\r\n generatedAt: \"February 23, 2026\",\r\n highlights: [\r\n \"Revenue accelerated after enterprise expansion campaign launch.\",\r\n \"Gross margin improved due to infrastructure cost renegotiation.\",\r\n \"Collections requires executive follow-up on two overdue accounts.\",\r\n ],\r\n period: \"Q1 2026\",\r\n rows: [\r\n {\r\n label: \"Enterprise Sales\",\r\n owner: \"A. Patel\",\r\n progress: 88,\r\n risk: \"Low\",\r\n status: \"On Track\",\r\n },\r\n {\r\n label: \"SMB Sales\",\r\n owner: \"L. Khan\",\r\n progress: 79,\r\n risk: \"Medium\",\r\n status: \"On Track\",\r\n },\r\n {\r\n label: \"Collections\",\r\n owner: \"J. Reyes\",\r\n progress: 63,\r\n risk: \"High\",\r\n status: \"At Risk\",\r\n },\r\n {\r\n label: \"Cost Optimization\",\r\n owner: \"K. Singh\",\r\n progress: 82,\r\n risk: \"Low\",\r\n status: \"On Track\",\r\n },\r\n ],\r\n series: [\r\n { label: \"W1\", value: 72 },\r\n { label: \"W2\", value: 74 },\r\n { label: \"W3\", value: 76 },\r\n { label: \"W4\", value: 77 },\r\n { label: \"W5\", value: 79 },\r\n { label: \"W6\", value: 80 },\r\n { label: \"W7\", value: 81 },\r\n { label: \"W8\", value: 83 },\r\n { label: \"W9\", value: 82 },\r\n { label: \"W10\", value: 84 },\r\n { label: \"W11\", value: 86 },\r\n { label: \"W12\", value: 88 },\r\n ],\r\n subtitle: \"Revenue, margin, and expense control overview\",\r\n summary: [\r\n { label: \"Revenue\", tone: \"success\", trend: \"+14.2% QoQ\", value: \"$2.48M\" },\r\n {\r\n label: \"Gross Margin\",\r\n tone: \"success\",\r\n trend: \"+2.1 pts\",\r\n value: \"61.8%\",\r\n },\r\n { label: \"Opex\", tone: \"success\", trend: \"-3.4% QoQ\", value: \"$0.93M\" },\r\n { label: \"Runway\", tone: \"info\", trend: \"Stable\", value: \"22 months\" },\r\n ],\r\n title: \"Quarterly Financial Report\",\r\n};\r\n\r\nexport const FinancialReportDocument = ({\r\n theme,\r\n data = sampleFinancialData,\r\n}: ReportTemplateProps) => (\r\n <ReportTemplateFrame\r\n theme={theme}\r\n data={data}\r\n titlePrefix=\"Financial Report\"\r\n statusLabel=\"Finance: Healthy\"\r\n statusTone=\"success\"\r\n graphVariant=\"line\"\r\n graphTitle=\"Revenue trajectory\"\r\n graphSubtitle=\"Quarterly weighted revenue index\"\r\n graphLegend=\"none\"\r\n graphColors={[\"#0F172A\"]}\r\n />\r\n);\r\n",
+ "content": "import { ReportTemplateFrame } from \"./report-layout\";\nimport type { ReportTemplateProps } from \"./report-layout\";\nimport type { BaseReportData } from \"./report.types\";\n\nconst sampleFinancialData: BaseReportData = {\n author: \"Finance Ops\",\n generatedAt: \"February 23, 2026\",\n highlights: [\n \"Revenue accelerated after enterprise expansion campaign launch.\",\n \"Gross margin improved due to infrastructure cost renegotiation.\",\n \"Collections requires executive follow-up on two overdue accounts.\",\n ],\n period: \"Q1 2026\",\n rows: [\n {\n label: \"Enterprise Sales\",\n owner: \"A. Patel\",\n progress: 88,\n risk: \"Low\",\n status: \"On Track\",\n },\n {\n label: \"SMB Sales\",\n owner: \"L. Khan\",\n progress: 79,\n risk: \"Medium\",\n status: \"On Track\",\n },\n {\n label: \"Collections\",\n owner: \"J. Reyes\",\n progress: 63,\n risk: \"High\",\n status: \"At Risk\",\n },\n {\n label: \"Cost Optimization\",\n owner: \"K. Singh\",\n progress: 82,\n risk: \"Low\",\n status: \"On Track\",\n },\n ],\n series: [\n { label: \"W1\", value: 72 },\n { label: \"W2\", value: 74 },\n { label: \"W3\", value: 76 },\n { label: \"W4\", value: 77 },\n { label: \"W5\", value: 79 },\n { label: \"W6\", value: 80 },\n { label: \"W7\", value: 81 },\n { label: \"W8\", value: 83 },\n { label: \"W9\", value: 82 },\n { label: \"W10\", value: 84 },\n { label: \"W11\", value: 86 },\n { label: \"W12\", value: 88 },\n ],\n subtitle: \"Revenue, margin, and expense control overview\",\n summary: [\n { label: \"Revenue\", tone: \"success\", trend: \"+14.2% QoQ\", value: \"$2.48M\" },\n {\n label: \"Gross Margin\",\n tone: \"success\",\n trend: \"+2.1 pts\",\n value: \"61.8%\",\n },\n { label: \"Opex\", tone: \"success\", trend: \"-3.4% QoQ\", value: \"$0.93M\" },\n { label: \"Runway\", tone: \"info\", trend: \"Stable\", value: \"22 months\" },\n ],\n title: \"Quarterly Financial Report\",\n};\n\nexport const FinancialReportDocument = ({\n theme,\n data = sampleFinancialData,\n}: ReportTemplateProps) => (\n <ReportTemplateFrame\n theme={theme}\n data={data}\n titlePrefix=\"Financial Report\"\n statusLabel=\"Finance: Healthy\"\n statusTone=\"success\"\n graphVariant=\"line\"\n graphTitle=\"Revenue trajectory\"\n graphSubtitle=\"Quarterly weighted revenue index\"\n graphLegend=\"none\"\n graphColors={[\"#0F172A\"]}\n />\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-financial/report-financial.tsx"
},
{
"path": "registry/bases/forme/blocks/report-financial/report-layout.tsx",
- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\r\n\r\nimport { Badge } from \"@/registry/bases/forme/components/badge/badge\";\r\nimport { DataTable } from \"@/registry/bases/forme/components/data-table/data-table\";\r\nimport { PdfGraph } from \"@/registry/bases/forme/components/graph/graph\";\r\nimport { KeyValue } from \"@/registry/bases/forme/components/key-value/key-value\";\r\nimport { PdfList } from \"@/registry/bases/forme/components/list/list\";\r\nimport { PageFooter } from \"@/registry/bases/forme/components/page-footer/page-footer\";\r\nimport { PageHeader } from \"@/registry/bases/forme/components/page-header/page-header\";\r\nimport { Section } from \"@/registry/bases/forme/components/section/section\";\r\nimport { Text } from \"@/registry/bases/forme/components/text/text\";\r\nimport {\r\n PdfcnThemeProvider,\r\n usePdfcnTheme,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { BaseReportData } from \"./report.types\";\r\n\r\nexport interface ReportTemplateProps {\r\n theme?: PdfcnTheme;\r\n data?: BaseReportData;\r\n}\r\n\r\ntype ReportGraphVariant =\r\n | \"bar\"\r\n | \"horizontal-bar\"\r\n | \"line\"\r\n | \"area\"\r\n | \"pie\"\r\n | \"donut\";\r\n\r\ninterface ReportLayoutProps {\r\n data: BaseReportData;\r\n titlePrefix: string;\r\n statusLabel: string;\r\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n graphVariant: ReportGraphVariant;\r\n graphTitle: string;\r\n graphSubtitle: string;\r\n graphLegend?: \"bottom\" | \"right\" | \"none\";\r\n graphShowValues?: boolean;\r\n graphColors?: string[];\r\n graphData?: { label: string; value: number }[];\r\n}\r\n\r\nconst toneColor = (\r\n theme: PdfcnTheme,\r\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\r\n) => {\r\n if (tone === \"success\") {\r\n return theme.colors.success;\r\n }\r\n if (tone === \"warning\") {\r\n return theme.colors.warning;\r\n }\r\n if (tone === \"destructive\") {\r\n return theme.colors.destructive;\r\n }\r\n return theme.colors.info;\r\n};\r\n\r\nexport const ReportLayout = ({\r\n data,\r\n titlePrefix,\r\n statusLabel,\r\n statusTone,\r\n graphVariant,\r\n graphTitle,\r\n graphSubtitle,\r\n graphLegend = \"none\",\r\n graphShowValues = false,\r\n graphColors,\r\n graphData,\r\n}: ReportLayoutProps) => {\r\n const theme = usePdfcnTheme();\r\n const accent = toneColor(theme, statusTone);\r\n const graphHeight: Record<ReportGraphVariant, number> = {\r\n area: 191,\r\n bar: 181,\r\n donut: 191,\r\n \"horizontal-bar\": 148,\r\n line: 191,\r\n pie: 191,\r\n };\r\n const deliveryOffset: Record<ReportGraphVariant, number> = {\r\n area: 0,\r\n bar: 59,\r\n donut: -3,\r\n \"horizontal-bar\": -4,\r\n line: -30,\r\n pie: 0,\r\n };\r\n const sectionOffset: Record<ReportGraphVariant, number> = {\r\n area: 0,\r\n bar: 32,\r\n donut: 0,\r\n \"horizontal-bar\": 0,\r\n line: 0,\r\n pie: 0,\r\n };\r\n const titleOffset: Record<ReportGraphVariant, number> = {\r\n area: 0,\r\n bar: 0,\r\n donut: 0,\r\n \"horizontal-bar\": 0,\r\n line: 0,\r\n pie: 0,\r\n };\r\n\r\n const styles = StyleSheet.create({\r\n col: {\r\n width: 225,\r\n },\r\n graphShell: {\r\n backgroundColor: theme.colors.background,\r\n borderColor: theme.colors.border,\r\n borderRadius: theme.primitives.borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n padding: 12,\r\n },\r\n metricCard: {\r\n alignItems: \"flex-start\",\r\n backgroundColor: theme.colors.background,\r\n borderColor: theme.colors.border,\r\n borderRadius: theme.primitives.borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n height: 75,\r\n padding: 8,\r\n width: 225,\r\n },\r\n metricLabel: {\r\n color: theme.colors.mutedForeground,\r\n fontSize: 8,\r\n letterSpacing: 0.5,\r\n marginBottom: 2,\r\n textTransform: \"uppercase\",\r\n },\r\n metricTrend: {\r\n color: theme.colors.mutedForeground,\r\n fontSize: 9,\r\n },\r\n metricValue: {\r\n color: theme.colors.foreground,\r\n fontSize: 14,\r\n fontWeight: theme.primitives.fontWeights.bold,\r\n marginBottom: 2,\r\n },\r\n metricsGrid: {\r\n flexDirection: \"column\",\r\n gap: 8,\r\n },\r\n metricsRow: {\r\n flexDirection: \"row\",\r\n gap: 8,\r\n },\r\n page: {\r\n backgroundColor: theme.colors.background,\r\n },\r\n toolbar: {\r\n alignItems: \"center\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n marginBottom: 8,\r\n width: 499,\r\n },\r\n twoColumn: {\r\n alignItems: \"flex-start\",\r\n flexDirection: \"row\",\r\n gap: 10,\r\n },\r\n });\r\n\r\n return (\r\n <Document title={`${titlePrefix} ${data.period}`}>\r\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n <View style={styles.page as never}>\r\n <PageHeader\r\n variant=\"two-column\"\r\n title={data.title}\r\n subtitle={`${titlePrefix} · ${data.subtitle}`}\r\n rightText={data.period}\r\n rightSubText={`Generated ${data.generatedAt}`}\r\n marginBottom={14}\r\n />\r\n\r\n <View style={styles.toolbar}>\r\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\r\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\r\n Author: {data.author}\r\n </Text>\r\n </View>\r\n\r\n <Section variant=\"card\" padding=\"md\" noWrap>\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Executive Summary\r\n </Text>\r\n <View style={styles.metricsGrid}>\r\n {[0, 2].map((startIndex) => (\r\n <View key={startIndex} style={styles.metricsRow}>\r\n {data.summary\r\n .slice(startIndex, startIndex + 2)\r\n .map((metric) => (\r\n <View\r\n key={metric.label}\r\n style={\r\n {\r\n ...styles.metricCard,\r\n borderLeftColor: metric.tone\r\n ? toneColor(theme, metric.tone)\r\n : accent,\r\n borderLeftWidth: 3,\r\n } as never\r\n }\r\n >\r\n <Text style={styles.metricLabel} noMargin>\r\n {metric.label}\r\n </Text>\r\n <Text style={styles.metricValue} noMargin>\r\n {metric.value}\r\n </Text>\r\n {metric.trend ? (\r\n <Badge\r\n label={metric.trend}\r\n size=\"sm\"\r\n variant={metric.tone ?? \"info\"}\r\n style={{\r\n height: 16,\r\n width: metric.trend.endsWith(\"QoQ\")\r\n ? metric.trend.length * 6.5 + 10\r\n : metric.trend.length * 5 + 18,\r\n }}\r\n />\r\n ) : null}\r\n </View>\r\n ))}\r\n </View>\r\n ))}\r\n </View>\r\n </Section>\r\n </View>\r\n </Page>\r\n\r\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n <View style={styles.page as never}>\r\n <Section\r\n padding=\"md\"\r\n noWrap\r\n style={{\r\n position: \"relative\",\r\n top: sectionOffset[graphVariant],\r\n }}\r\n >\r\n <Text\r\n variant=\"sm\"\r\n transform=\"uppercase\"\r\n color=\"mutedForeground\"\r\n style={{\r\n position: \"relative\",\r\n top: titleOffset[graphVariant],\r\n }}\r\n >\r\n Performance Trend\r\n </Text>\r\n <View\r\n style={\r\n {\r\n ...styles.graphShell,\r\n paddingBottom: graphVariant === \"horizontal-bar\" ? 56 : 12,\r\n } as never\r\n }\r\n >\r\n <PdfGraph\r\n variant={graphVariant}\r\n data={graphData ?? data.series}\r\n title={graphTitle}\r\n subtitle={graphSubtitle}\r\n yLabel={undefined}\r\n xLabel={undefined}\r\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\r\n showValues={graphShowValues}\r\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\r\n legend={graphLegend}\r\n height={graphHeight[graphVariant]}\r\n colors={graphColors}\r\n fullWidth\r\n containerPadding={12}\r\n wrapperPadding={12}\r\n style={{ marginBottom: 0 }}\r\n />\r\n </View>\r\n </Section>\r\n\r\n <Section\r\n padding=\"md\"\r\n style={{\r\n position: \"relative\",\r\n top: deliveryOffset[graphVariant],\r\n }}\r\n >\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Delivery Table\r\n </Text>\r\n <DataTable\r\n variant=\"compact\"\r\n size=\"compact\"\r\n stripe\r\n columns={[\r\n { header: \"Stream\", key: \"label\" },\r\n { header: \"Owner\", key: \"owner\" },\r\n { align: \"center\", header: \"Status\", key: \"status\" },\r\n {\r\n align: \"right\",\r\n header: \"Progress\",\r\n key: \"progress\",\r\n render: (value) => `${String(value)}%`,\r\n },\r\n { align: \"right\", header: \"Risk\", key: \"risk\" },\r\n ]}\r\n data={data.rows}\r\n footer={{\r\n label: \"Totals\",\r\n owner: \"-\",\r\n progress: Math.round(\r\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\r\n Math.max(data.rows.length, 1)\r\n ),\r\n risk: \"-\",\r\n status: \"-\",\r\n }}\r\n />\r\n </Section>\r\n </View>\r\n </Page>\r\n\r\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n <View style={styles.page as never}>\r\n <Section padding=\"md\" variant=\"card\" noWrap>\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Highlights & Risks\r\n </Text>\r\n <View style={styles.twoColumn}>\r\n <View style={styles.col}>\r\n <PdfList\r\n variant=\"checklist\"\r\n items={data.highlights.map((item) => ({\r\n checked: true,\r\n text: item,\r\n }))}\r\n gap=\"sm\"\r\n />\r\n </View>\r\n <View style={styles.col}>\r\n <KeyValue\r\n size=\"sm\"\r\n divided\r\n items={[\r\n {\r\n key: \"Open Risks\",\r\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\r\n },\r\n {\r\n key: \"On-Track Streams\",\r\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\r\n },\r\n {\r\n key: \"Avg Progress\",\r\n value: `${Math.round(\r\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\r\n Math.max(data.rows.length, 1)\r\n )}%`,\r\n },\r\n ]}\r\n />\r\n </View>\r\n </View>\r\n </Section>\r\n </View>\r\n </Page>\r\n </Document>\r\n );\r\n};\r\n\r\nexport const ReportTemplateFrame = ({\r\n theme,\r\n data,\r\n titlePrefix,\r\n statusLabel,\r\n statusTone,\r\n graphVariant,\r\n graphTitle,\r\n graphSubtitle,\r\n graphLegend,\r\n graphShowValues,\r\n graphColors,\r\n graphData,\r\n}: ReportTemplateProps & {\r\n titlePrefix: string;\r\n statusLabel: string;\r\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n graphVariant: ReportGraphVariant;\r\n graphTitle: string;\r\n graphSubtitle: string;\r\n graphLegend?: \"bottom\" | \"right\" | \"none\";\r\n graphShowValues?: boolean;\r\n graphColors?: string[];\r\n graphData?: { label: string; value: number }[];\r\n}) => {\r\n if (!data) {\r\n return null;\r\n }\r\n\r\n return (\r\n <PdfcnThemeProvider theme={theme}>\r\n <ReportLayout\r\n data={data}\r\n titlePrefix={titlePrefix}\r\n statusLabel={statusLabel}\r\n statusTone={statusTone}\r\n graphVariant={graphVariant}\r\n graphTitle={graphTitle}\r\n graphSubtitle={graphSubtitle}\r\n graphLegend={graphLegend}\r\n graphShowValues={graphShowValues}\r\n graphColors={graphColors}\r\n graphData={graphData}\r\n />\r\n </PdfcnThemeProvider>\r\n );\r\n};\r\n",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { Badge } from \"@/components/pdf/badge/badge\";\nimport { DataTable } from \"@/components/pdf/data-table/data-table\";\nimport { PdfGraph } from \"@/components/pdf/graph/graph\";\nimport { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PdfList } from \"@/components/pdf/list/list\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { PageNumber } from \"@/components/pdf/page-number/page-number\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n const graphHeight: Record<ReportGraphVariant, number> = {\n area: 191,\n bar: 181,\n donut: 191,\n \"horizontal-bar\": 148,\n line: 191,\n pie: 191,\n };\n const deliveryOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 59,\n donut: -3,\n \"horizontal-bar\": -4,\n line: -30,\n pie: 0,\n };\n const sectionOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 32,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n const titleOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 0,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n\n const styles = StyleSheet.create({\n col: {\n width: 225,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n alignItems: \"flex-start\",\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n height: 75,\n padding: 8,\n width: 225,\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"column\",\n gap: 8,\n },\n metricsRow: {\n flexDirection: \"row\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n width: 499,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber align=\"right\" size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {[0, 2].map((startIndex) => (\n <View key={startIndex} style={styles.metricsRow}>\n {data.summary\n .slice(startIndex, startIndex + 2)\n .map((metric) => (\n <View\n key={metric.label}\n style={\n {\n ...styles.metricCard,\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n } as never\n }\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n style={{\n height: 16,\n width: metric.trend.endsWith(\"QoQ\")\n ? metric.trend.length * 6.5 + 10\n : metric.trend.length * 5 + 18,\n }}\n />\n ) : null}\n </View>\n ))}\n </View>\n ))}\n </View>\n </Section>\n </View>\n </Page>\n\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber align=\"right\" size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <Section\n padding=\"md\"\n noWrap\n style={{\n position: \"relative\",\n top: sectionOffset[graphVariant],\n }}\n >\n <Text\n variant=\"sm\"\n transform=\"uppercase\"\n color=\"mutedForeground\"\n style={{\n position: \"relative\",\n top: titleOffset[graphVariant],\n }}\n >\n Performance Trend\n </Text>\n <View\n style={\n {\n ...styles.graphShell,\n paddingBottom: graphVariant === \"horizontal-bar\" ? 56 : 12,\n } as never\n }\n >\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={graphHeight[graphVariant]}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section\n padding=\"md\"\n style={{\n position: \"relative\",\n top: deliveryOffset[graphVariant],\n }}\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n </View>\n </Page>\n\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber align=\"right\" size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Avg Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n </Section>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-financial/report-layout.tsx"
},
{
"path": "registry/bases/forme/blocks/report-financial/report.types.ts",
- "content": "export interface SummaryMetric {\r\n label: string;\r\n value: string;\r\n trend?: string;\r\n tone?: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n}\r\n\r\nexport type ReportRow = Record<string, unknown> & {\r\n label: string;\r\n owner: string;\r\n status: string;\r\n progress: number;\r\n risk?: string;\r\n};\r\n\r\nexport interface ReportSeriesPoint {\r\n label: string;\r\n value: number;\r\n}\r\n\r\nexport interface BaseReportData {\r\n title: string;\r\n subtitle: string;\r\n generatedAt: string;\r\n period: string;\r\n author: string;\r\n summary: SummaryMetric[];\r\n rows: ReportRow[];\r\n series: ReportSeriesPoint[];\r\n highlights: string[];\r\n}\r\n",
+ "content": "export interface SummaryMetric {\n label: string;\n value: string;\n trend?: string;\n tone?: \"success\" | \"warning\" | \"destructive\" | \"info\";\n}\n\nexport type ReportRow = Record<string, unknown> & {\n label: string;\n owner: string;\n status: string;\n progress: number;\n risk?: string;\n};\n\nexport interface ReportSeriesPoint {\n label: string;\n value: number;\n}\n\nexport interface BaseReportData {\n title: string;\n subtitle: string;\n generatedAt: string;\n period: string;\n author: string;\n summary: SummaryMetric[];\n rows: ReportRow[];\n series: ReportSeriesPoint[];\n highlights: string[];\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-financial/report.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/report-marketing.json b/apps/web/public/r/forme/report-marketing.json
index 043897a..bbe6dc5 100644
--- a/apps/web/public/r/forme/report-marketing.json
+++ b/apps/web/public/r/forme/report-marketing.json
@@ -14,6 +14,7 @@
"@pdfcn/forme/key-value",
"@pdfcn/forme/page-footer",
"@pdfcn/forme/page-header",
+ "@pdfcn/forme/page-number",
"@pdfcn/forme/graph",
"@pdfcn/forme/list",
"@pdfcn/forme/section",
@@ -22,22 +23,22 @@
"files": [
{
"path": "registry/bases/forme/blocks/report-marketing/report-layout.tsx",
- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\r\n\r\nimport { Badge } from \"@/registry/bases/forme/components/badge/badge\";\r\nimport { DataTable } from \"@/registry/bases/forme/components/data-table/data-table\";\r\nimport { PdfGraph } from \"@/registry/bases/forme/components/graph/graph\";\r\nimport { KeyValue } from \"@/registry/bases/forme/components/key-value/key-value\";\r\nimport { PdfList } from \"@/registry/bases/forme/components/list/list\";\r\nimport { PageFooter } from \"@/registry/bases/forme/components/page-footer/page-footer\";\r\nimport { PageHeader } from \"@/registry/bases/forme/components/page-header/page-header\";\r\nimport { Section } from \"@/registry/bases/forme/components/section/section\";\r\nimport { Text } from \"@/registry/bases/forme/components/text/text\";\r\nimport {\r\n PdfcnThemeProvider,\r\n usePdfcnTheme,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { BaseReportData } from \"./report.types\";\r\n\r\nexport interface ReportTemplateProps {\r\n theme?: PdfcnTheme;\r\n data?: BaseReportData;\r\n}\r\n\r\ntype ReportGraphVariant =\r\n | \"bar\"\r\n | \"horizontal-bar\"\r\n | \"line\"\r\n | \"area\"\r\n | \"pie\"\r\n | \"donut\";\r\n\r\ninterface ReportLayoutProps {\r\n data: BaseReportData;\r\n titlePrefix: string;\r\n statusLabel: string;\r\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n graphVariant: ReportGraphVariant;\r\n graphTitle: string;\r\n graphSubtitle: string;\r\n graphLegend?: \"bottom\" | \"right\" | \"none\";\r\n graphShowValues?: boolean;\r\n graphColors?: string[];\r\n graphData?: { label: string; value: number }[];\r\n}\r\n\r\nconst toneColor = (\r\n theme: PdfcnTheme,\r\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\r\n) => {\r\n if (tone === \"success\") {\r\n return theme.colors.success;\r\n }\r\n if (tone === \"warning\") {\r\n return theme.colors.warning;\r\n }\r\n if (tone === \"destructive\") {\r\n return theme.colors.destructive;\r\n }\r\n return theme.colors.info;\r\n};\r\n\r\nexport const ReportLayout = ({\r\n data,\r\n titlePrefix,\r\n statusLabel,\r\n statusTone,\r\n graphVariant,\r\n graphTitle,\r\n graphSubtitle,\r\n graphLegend = \"none\",\r\n graphShowValues = false,\r\n graphColors,\r\n graphData,\r\n}: ReportLayoutProps) => {\r\n const theme = usePdfcnTheme();\r\n const accent = toneColor(theme, statusTone);\r\n const graphHeight: Record<ReportGraphVariant, number> = {\r\n area: 191,\r\n bar: 181,\r\n donut: 191,\r\n \"horizontal-bar\": 148,\r\n line: 191,\r\n pie: 191,\r\n };\r\n const deliveryOffset: Record<ReportGraphVariant, number> = {\r\n area: 0,\r\n bar: 59,\r\n donut: -3,\r\n \"horizontal-bar\": -4,\r\n line: -30,\r\n pie: 0,\r\n };\r\n const sectionOffset: Record<ReportGraphVariant, number> = {\r\n area: 0,\r\n bar: 32,\r\n donut: 0,\r\n \"horizontal-bar\": 0,\r\n line: 0,\r\n pie: 0,\r\n };\r\n const titleOffset: Record<ReportGraphVariant, number> = {\r\n area: 0,\r\n bar: 0,\r\n donut: 0,\r\n \"horizontal-bar\": 0,\r\n line: 0,\r\n pie: 0,\r\n };\r\n\r\n const styles = StyleSheet.create({\r\n col: {\r\n width: 225,\r\n },\r\n graphShell: {\r\n backgroundColor: theme.colors.background,\r\n borderColor: theme.colors.border,\r\n borderRadius: theme.primitives.borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n padding: 12,\r\n },\r\n metricCard: {\r\n alignItems: \"flex-start\",\r\n backgroundColor: theme.colors.background,\r\n borderColor: theme.colors.border,\r\n borderRadius: theme.primitives.borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n height: 75,\r\n padding: 8,\r\n width: 225,\r\n },\r\n metricLabel: {\r\n color: theme.colors.mutedForeground,\r\n fontSize: 8,\r\n letterSpacing: 0.5,\r\n marginBottom: 2,\r\n textTransform: \"uppercase\",\r\n },\r\n metricTrend: {\r\n color: theme.colors.mutedForeground,\r\n fontSize: 9,\r\n },\r\n metricValue: {\r\n color: theme.colors.foreground,\r\n fontSize: 14,\r\n fontWeight: theme.primitives.fontWeights.bold,\r\n marginBottom: 2,\r\n },\r\n metricsGrid: {\r\n flexDirection: \"column\",\r\n gap: 8,\r\n },\r\n metricsRow: {\r\n flexDirection: \"row\",\r\n gap: 8,\r\n },\r\n page: {\r\n backgroundColor: theme.colors.background,\r\n },\r\n toolbar: {\r\n alignItems: \"center\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n marginBottom: 8,\r\n width: 499,\r\n },\r\n twoColumn: {\r\n alignItems: \"flex-start\",\r\n flexDirection: \"row\",\r\n gap: 10,\r\n },\r\n });\r\n\r\n return (\r\n <Document title={`${titlePrefix} ${data.period}`}>\r\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n <View style={styles.page as never}>\r\n <PageHeader\r\n variant=\"two-column\"\r\n title={data.title}\r\n subtitle={`${titlePrefix} · ${data.subtitle}`}\r\n rightText={data.period}\r\n rightSubText={`Generated ${data.generatedAt}`}\r\n marginBottom={14}\r\n />\r\n\r\n <View style={styles.toolbar}>\r\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\r\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\r\n Author: {data.author}\r\n </Text>\r\n </View>\r\n\r\n <Section variant=\"card\" padding=\"md\" noWrap>\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Executive Summary\r\n </Text>\r\n <View style={styles.metricsGrid}>\r\n {[0, 2].map((startIndex) => (\r\n <View key={startIndex} style={styles.metricsRow}>\r\n {data.summary\r\n .slice(startIndex, startIndex + 2)\r\n .map((metric) => (\r\n <View\r\n key={metric.label}\r\n style={\r\n {\r\n ...styles.metricCard,\r\n borderLeftColor: metric.tone\r\n ? toneColor(theme, metric.tone)\r\n : accent,\r\n borderLeftWidth: 3,\r\n } as never\r\n }\r\n >\r\n <Text style={styles.metricLabel} noMargin>\r\n {metric.label}\r\n </Text>\r\n <Text style={styles.metricValue} noMargin>\r\n {metric.value}\r\n </Text>\r\n {metric.trend ? (\r\n <Badge\r\n label={metric.trend}\r\n size=\"sm\"\r\n variant={metric.tone ?? \"info\"}\r\n style={{\r\n height: 16,\r\n width: metric.trend.endsWith(\"QoQ\")\r\n ? metric.trend.length * 6.5 + 10\r\n : metric.trend.length * 5 + 18,\r\n }}\r\n />\r\n ) : null}\r\n </View>\r\n ))}\r\n </View>\r\n ))}\r\n </View>\r\n </Section>\r\n </View>\r\n </Page>\r\n\r\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n <View style={styles.page as never}>\r\n <Section\r\n padding=\"md\"\r\n noWrap\r\n style={{\r\n position: \"relative\",\r\n top: sectionOffset[graphVariant],\r\n }}\r\n >\r\n <Text\r\n variant=\"sm\"\r\n transform=\"uppercase\"\r\n color=\"mutedForeground\"\r\n style={{\r\n position: \"relative\",\r\n top: titleOffset[graphVariant],\r\n }}\r\n >\r\n Performance Trend\r\n </Text>\r\n <View\r\n style={\r\n {\r\n ...styles.graphShell,\r\n paddingBottom: graphVariant === \"horizontal-bar\" ? 56 : 12,\r\n } as never\r\n }\r\n >\r\n <PdfGraph\r\n variant={graphVariant}\r\n data={graphData ?? data.series}\r\n title={graphTitle}\r\n subtitle={graphSubtitle}\r\n yLabel={undefined}\r\n xLabel={undefined}\r\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\r\n showValues={graphShowValues}\r\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\r\n legend={graphLegend}\r\n height={graphHeight[graphVariant]}\r\n colors={graphColors}\r\n fullWidth\r\n containerPadding={12}\r\n wrapperPadding={12}\r\n style={{ marginBottom: 0 }}\r\n />\r\n </View>\r\n </Section>\r\n\r\n <Section\r\n padding=\"md\"\r\n style={{\r\n position: \"relative\",\r\n top: deliveryOffset[graphVariant],\r\n }}\r\n >\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Delivery Table\r\n </Text>\r\n <DataTable\r\n variant=\"compact\"\r\n size=\"compact\"\r\n stripe\r\n columns={[\r\n { header: \"Stream\", key: \"label\" },\r\n { header: \"Owner\", key: \"owner\" },\r\n { align: \"center\", header: \"Status\", key: \"status\" },\r\n {\r\n align: \"right\",\r\n header: \"Progress\",\r\n key: \"progress\",\r\n render: (value) => `${String(value)}%`,\r\n },\r\n { align: \"right\", header: \"Risk\", key: \"risk\" },\r\n ]}\r\n data={data.rows}\r\n footer={{\r\n label: \"Totals\",\r\n owner: \"-\",\r\n progress: Math.round(\r\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\r\n Math.max(data.rows.length, 1)\r\n ),\r\n risk: \"-\",\r\n status: \"-\",\r\n }}\r\n />\r\n </Section>\r\n </View>\r\n </Page>\r\n\r\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n <View style={styles.page as never}>\r\n <Section padding=\"md\" variant=\"card\" noWrap>\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Highlights & Risks\r\n </Text>\r\n <View style={styles.twoColumn}>\r\n <View style={styles.col}>\r\n <PdfList\r\n variant=\"checklist\"\r\n items={data.highlights.map((item) => ({\r\n checked: true,\r\n text: item,\r\n }))}\r\n gap=\"sm\"\r\n />\r\n </View>\r\n <View style={styles.col}>\r\n <KeyValue\r\n size=\"sm\"\r\n divided\r\n items={[\r\n {\r\n key: \"Open Risks\",\r\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\r\n },\r\n {\r\n key: \"On-Track Streams\",\r\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\r\n },\r\n {\r\n key: \"Avg Progress\",\r\n value: `${Math.round(\r\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\r\n Math.max(data.rows.length, 1)\r\n )}%`,\r\n },\r\n ]}\r\n />\r\n </View>\r\n </View>\r\n </Section>\r\n </View>\r\n </Page>\r\n </Document>\r\n );\r\n};\r\n\r\nexport const ReportTemplateFrame = ({\r\n theme,\r\n data,\r\n titlePrefix,\r\n statusLabel,\r\n statusTone,\r\n graphVariant,\r\n graphTitle,\r\n graphSubtitle,\r\n graphLegend,\r\n graphShowValues,\r\n graphColors,\r\n graphData,\r\n}: ReportTemplateProps & {\r\n titlePrefix: string;\r\n statusLabel: string;\r\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n graphVariant: ReportGraphVariant;\r\n graphTitle: string;\r\n graphSubtitle: string;\r\n graphLegend?: \"bottom\" | \"right\" | \"none\";\r\n graphShowValues?: boolean;\r\n graphColors?: string[];\r\n graphData?: { label: string; value: number }[];\r\n}) => {\r\n if (!data) {\r\n return null;\r\n }\r\n\r\n return (\r\n <PdfcnThemeProvider theme={theme}>\r\n <ReportLayout\r\n data={data}\r\n titlePrefix={titlePrefix}\r\n statusLabel={statusLabel}\r\n statusTone={statusTone}\r\n graphVariant={graphVariant}\r\n graphTitle={graphTitle}\r\n graphSubtitle={graphSubtitle}\r\n graphLegend={graphLegend}\r\n graphShowValues={graphShowValues}\r\n graphColors={graphColors}\r\n graphData={graphData}\r\n />\r\n </PdfcnThemeProvider>\r\n );\r\n};\r\n",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { Badge } from \"@/components/pdf/badge/badge\";\nimport { DataTable } from \"@/components/pdf/data-table/data-table\";\nimport { PdfGraph } from \"@/components/pdf/graph/graph\";\nimport { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PdfList } from \"@/components/pdf/list/list\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { PageNumber } from \"@/components/pdf/page-number/page-number\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n const graphHeight: Record<ReportGraphVariant, number> = {\n area: 191,\n bar: 181,\n donut: 191,\n \"horizontal-bar\": 148,\n line: 191,\n pie: 191,\n };\n const deliveryOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 59,\n donut: -3,\n \"horizontal-bar\": -4,\n line: -30,\n pie: 0,\n };\n const sectionOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 32,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n const titleOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 0,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n\n const styles = StyleSheet.create({\n col: {\n width: 225,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n alignItems: \"flex-start\",\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n height: 75,\n padding: 8,\n width: 225,\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"column\",\n gap: 8,\n },\n metricsRow: {\n flexDirection: \"row\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n width: 499,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber align=\"right\" size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {[0, 2].map((startIndex) => (\n <View key={startIndex} style={styles.metricsRow}>\n {data.summary\n .slice(startIndex, startIndex + 2)\n .map((metric) => (\n <View\n key={metric.label}\n style={\n {\n ...styles.metricCard,\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n } as never\n }\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n style={{\n height: 16,\n width: metric.trend.endsWith(\"QoQ\")\n ? metric.trend.length * 6.5 + 10\n : metric.trend.length * 5 + 18,\n }}\n />\n ) : null}\n </View>\n ))}\n </View>\n ))}\n </View>\n </Section>\n </View>\n </Page>\n\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber align=\"right\" size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <Section\n padding=\"md\"\n noWrap\n style={{\n position: \"relative\",\n top: sectionOffset[graphVariant],\n }}\n >\n <Text\n variant=\"sm\"\n transform=\"uppercase\"\n color=\"mutedForeground\"\n style={{\n position: \"relative\",\n top: titleOffset[graphVariant],\n }}\n >\n Performance Trend\n </Text>\n <View\n style={\n {\n ...styles.graphShell,\n paddingBottom: graphVariant === \"horizontal-bar\" ? 56 : 12,\n } as never\n }\n >\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={graphHeight[graphVariant]}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section\n padding=\"md\"\n style={{\n position: \"relative\",\n top: deliveryOffset[graphVariant],\n }}\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n </View>\n </Page>\n\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber align=\"right\" size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Avg Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n </Section>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-marketing/report-layout.tsx"
},
{
"path": "registry/bases/forme/blocks/report-marketing/report-marketing.tsx",
- "content": "import { ReportTemplateFrame } from \"./report-layout\";\r\nimport type { ReportTemplateProps } from \"./report-layout\";\r\nimport type { BaseReportData } from \"./report.types\";\r\n\r\nconst sampleMarketingData: BaseReportData = {\r\n author: \"Growth Team\",\r\n generatedAt: \"February 23, 2026\",\r\n highlights: [\r\n \"Channel mix improved CAC while maintaining lead quality.\",\r\n \"Lifecycle email workflow has deliverability issues under investigation.\",\r\n \"Referral program is producing higher-intent pipeline with lower cost.\",\r\n ],\r\n period: \"Campaign Cycle 2026-02\",\r\n rows: [\r\n {\r\n label: \"SEO\",\r\n owner: \"H. Evans\",\r\n progress: 84,\r\n risk: \"Low\",\r\n status: \"On Track\",\r\n },\r\n {\r\n label: \"Paid Search\",\r\n owner: \"K. Martin\",\r\n progress: 80,\r\n risk: \"Low\",\r\n status: \"On Track\",\r\n },\r\n {\r\n label: \"Lifecycle Email\",\r\n owner: \"V. Lee\",\r\n progress: 64,\r\n risk: \"Medium\",\r\n status: \"At Risk\",\r\n },\r\n {\r\n label: \"Partner Referrals\",\r\n owner: \"J. Gomez\",\r\n progress: 75,\r\n risk: \"Medium\",\r\n status: \"On Track\",\r\n },\r\n ],\r\n series: [\r\n { label: \"W1\", value: 55 },\r\n { label: \"W2\", value: 57 },\r\n { label: \"W3\", value: 59 },\r\n { label: \"W4\", value: 60 },\r\n { label: \"W5\", value: 62 },\r\n { label: \"W6\", value: 63 },\r\n { label: \"W7\", value: 65 },\r\n { label: \"W8\", value: 67 },\r\n { label: \"W9\", value: 66 },\r\n { label: \"W10\", value: 68 },\r\n { label: \"W11\", value: 70 },\r\n { label: \"W12\", value: 72 },\r\n ],\r\n subtitle: \"Pipeline, conversion efficiency, and channel performance\",\r\n summary: [\r\n { label: \"MQLs\", tone: \"success\", trend: \"+22.1% cycle\", value: \"3,940\" },\r\n { label: \"CAC\", tone: \"success\", trend: \"-7.4%\", value: \"$118\" },\r\n { label: \"Win Rate\", tone: \"info\", trend: \"+1.1 pts\", value: \"28.6%\" },\r\n { label: \"Churn Risk\", tone: \"warning\", trend: \"+0.8 pts\", value: \"6.2%\" },\r\n ],\r\n title: \"Growth & Marketing Report\",\r\n};\r\n\r\nexport const MarketingReportDocument = ({\r\n theme,\r\n data = sampleMarketingData,\r\n}: ReportTemplateProps) => (\r\n <ReportTemplateFrame\r\n theme={theme}\r\n data={data}\r\n titlePrefix=\"Growth Report\"\r\n statusLabel=\"Growth: Strong\"\r\n statusTone=\"success\"\r\n graphVariant=\"bar\"\r\n graphTitle=\"Pipeline build by week\"\r\n graphSubtitle=\"Demand creation output trend\"\r\n graphLegend=\"none\"\r\n graphShowValues\r\n graphColors={[\"#0EA5E9\"]}\r\n />\r\n);\r\n",
+ "content": "import { ReportTemplateFrame } from \"./report-layout\";\nimport type { ReportTemplateProps } from \"./report-layout\";\nimport type { BaseReportData } from \"./report.types\";\n\nconst sampleMarketingData: BaseReportData = {\n author: \"Growth Team\",\n generatedAt: \"February 23, 2026\",\n highlights: [\n \"Channel mix improved CAC while maintaining lead quality.\",\n \"Lifecycle email workflow has deliverability issues under investigation.\",\n \"Referral program is producing higher-intent pipeline with lower cost.\",\n ],\n period: \"Campaign Cycle 2026-02\",\n rows: [\n {\n label: \"SEO\",\n owner: \"H. Evans\",\n progress: 84,\n risk: \"Low\",\n status: \"On Track\",\n },\n {\n label: \"Paid Search\",\n owner: \"K. Martin\",\n progress: 80,\n risk: \"Low\",\n status: \"On Track\",\n },\n {\n label: \"Lifecycle Email\",\n owner: \"V. Lee\",\n progress: 64,\n risk: \"Medium\",\n status: \"At Risk\",\n },\n {\n label: \"Partner Referrals\",\n owner: \"J. Gomez\",\n progress: 75,\n risk: \"Medium\",\n status: \"On Track\",\n },\n ],\n series: [\n { label: \"W1\", value: 55 },\n { label: \"W2\", value: 57 },\n { label: \"W3\", value: 59 },\n { label: \"W4\", value: 60 },\n { label: \"W5\", value: 62 },\n { label: \"W6\", value: 63 },\n { label: \"W7\", value: 65 },\n { label: \"W8\", value: 67 },\n { label: \"W9\", value: 66 },\n { label: \"W10\", value: 68 },\n { label: \"W11\", value: 70 },\n { label: \"W12\", value: 72 },\n ],\n subtitle: \"Pipeline, conversion efficiency, and channel performance\",\n summary: [\n { label: \"MQLs\", tone: \"success\", trend: \"+22.1% cycle\", value: \"3,940\" },\n { label: \"CAC\", tone: \"success\", trend: \"-7.4%\", value: \"$118\" },\n { label: \"Win Rate\", tone: \"info\", trend: \"+1.1 pts\", value: \"28.6%\" },\n { label: \"Churn Risk\", tone: \"warning\", trend: \"+0.8 pts\", value: \"6.2%\" },\n ],\n title: \"Growth & Marketing Report\",\n};\n\nexport const MarketingReportDocument = ({\n theme,\n data = sampleMarketingData,\n}: ReportTemplateProps) => (\n <ReportTemplateFrame\n theme={theme}\n data={data}\n titlePrefix=\"Growth Report\"\n statusLabel=\"Growth: Strong\"\n statusTone=\"success\"\n graphVariant=\"bar\"\n graphTitle=\"Pipeline build by week\"\n graphSubtitle=\"Demand creation output trend\"\n graphLegend=\"none\"\n graphShowValues\n graphColors={[\"#0EA5E9\"]}\n />\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-marketing/report-marketing.tsx"
},
{
"path": "registry/bases/forme/blocks/report-marketing/report.types.ts",
- "content": "export interface SummaryMetric {\r\n label: string;\r\n value: string;\r\n trend?: string;\r\n tone?: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n}\r\n\r\nexport type ReportRow = Record<string, unknown> & {\r\n label: string;\r\n owner: string;\r\n status: string;\r\n progress: number;\r\n risk?: string;\r\n};\r\n\r\nexport interface ReportSeriesPoint {\r\n label: string;\r\n value: number;\r\n}\r\n\r\nexport interface BaseReportData {\r\n title: string;\r\n subtitle: string;\r\n generatedAt: string;\r\n period: string;\r\n author: string;\r\n summary: SummaryMetric[];\r\n rows: ReportRow[];\r\n series: ReportSeriesPoint[];\r\n highlights: string[];\r\n}\r\n",
+ "content": "export interface SummaryMetric {\n label: string;\n value: string;\n trend?: string;\n tone?: \"success\" | \"warning\" | \"destructive\" | \"info\";\n}\n\nexport type ReportRow = Record<string, unknown> & {\n label: string;\n owner: string;\n status: string;\n progress: number;\n risk?: string;\n};\n\nexport interface ReportSeriesPoint {\n label: string;\n value: number;\n}\n\nexport interface BaseReportData {\n title: string;\n subtitle: string;\n generatedAt: string;\n period: string;\n author: string;\n summary: SummaryMetric[];\n rows: ReportRow[];\n series: ReportSeriesPoint[];\n highlights: string[];\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-marketing/report.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/report-operations.json b/apps/web/public/r/forme/report-operations.json
index 493b3f0..bc63238 100644
--- a/apps/web/public/r/forme/report-operations.json
+++ b/apps/web/public/r/forme/report-operations.json
@@ -14,6 +14,7 @@
"@pdfcn/forme/key-value",
"@pdfcn/forme/page-footer",
"@pdfcn/forme/page-header",
+ "@pdfcn/forme/page-number",
"@pdfcn/forme/graph",
"@pdfcn/forme/list",
"@pdfcn/forme/section",
@@ -22,22 +23,22 @@
"files": [
{
"path": "registry/bases/forme/blocks/report-operations/report-layout.tsx",
- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\r\n\r\nimport { Badge } from \"@/registry/bases/forme/components/badge/badge\";\r\nimport { DataTable } from \"@/registry/bases/forme/components/data-table/data-table\";\r\nimport { PdfGraph } from \"@/registry/bases/forme/components/graph/graph\";\r\nimport { KeyValue } from \"@/registry/bases/forme/components/key-value/key-value\";\r\nimport { PdfList } from \"@/registry/bases/forme/components/list/list\";\r\nimport { PageFooter } from \"@/registry/bases/forme/components/page-footer/page-footer\";\r\nimport { PageHeader } from \"@/registry/bases/forme/components/page-header/page-header\";\r\nimport { Section } from \"@/registry/bases/forme/components/section/section\";\r\nimport { Text } from \"@/registry/bases/forme/components/text/text\";\r\nimport {\r\n PdfcnThemeProvider,\r\n usePdfcnTheme,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { BaseReportData } from \"./report.types\";\r\n\r\nexport interface ReportTemplateProps {\r\n theme?: PdfcnTheme;\r\n data?: BaseReportData;\r\n}\r\n\r\ntype ReportGraphVariant =\r\n | \"bar\"\r\n | \"horizontal-bar\"\r\n | \"line\"\r\n | \"area\"\r\n | \"pie\"\r\n | \"donut\";\r\n\r\ninterface ReportLayoutProps {\r\n data: BaseReportData;\r\n titlePrefix: string;\r\n statusLabel: string;\r\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n graphVariant: ReportGraphVariant;\r\n graphTitle: string;\r\n graphSubtitle: string;\r\n graphLegend?: \"bottom\" | \"right\" | \"none\";\r\n graphShowValues?: boolean;\r\n graphColors?: string[];\r\n graphData?: { label: string; value: number }[];\r\n}\r\n\r\nconst toneColor = (\r\n theme: PdfcnTheme,\r\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\r\n) => {\r\n if (tone === \"success\") {\r\n return theme.colors.success;\r\n }\r\n if (tone === \"warning\") {\r\n return theme.colors.warning;\r\n }\r\n if (tone === \"destructive\") {\r\n return theme.colors.destructive;\r\n }\r\n return theme.colors.info;\r\n};\r\n\r\nexport const ReportLayout = ({\r\n data,\r\n titlePrefix,\r\n statusLabel,\r\n statusTone,\r\n graphVariant,\r\n graphTitle,\r\n graphSubtitle,\r\n graphLegend = \"none\",\r\n graphShowValues = false,\r\n graphColors,\r\n graphData,\r\n}: ReportLayoutProps) => {\r\n const theme = usePdfcnTheme();\r\n const accent = toneColor(theme, statusTone);\r\n const graphHeight: Record<ReportGraphVariant, number> = {\r\n area: 191,\r\n bar: 181,\r\n donut: 191,\r\n \"horizontal-bar\": 148,\r\n line: 191,\r\n pie: 191,\r\n };\r\n const deliveryOffset: Record<ReportGraphVariant, number> = {\r\n area: 0,\r\n bar: 59,\r\n donut: -3,\r\n \"horizontal-bar\": -4,\r\n line: -30,\r\n pie: 0,\r\n };\r\n const sectionOffset: Record<ReportGraphVariant, number> = {\r\n area: 0,\r\n bar: 32,\r\n donut: 0,\r\n \"horizontal-bar\": 0,\r\n line: 0,\r\n pie: 0,\r\n };\r\n const titleOffset: Record<ReportGraphVariant, number> = {\r\n area: 0,\r\n bar: 0,\r\n donut: 0,\r\n \"horizontal-bar\": 0,\r\n line: 0,\r\n pie: 0,\r\n };\r\n\r\n const styles = StyleSheet.create({\r\n col: {\r\n width: 225,\r\n },\r\n graphShell: {\r\n backgroundColor: theme.colors.background,\r\n borderColor: theme.colors.border,\r\n borderRadius: theme.primitives.borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n padding: 12,\r\n },\r\n metricCard: {\r\n alignItems: \"flex-start\",\r\n backgroundColor: theme.colors.background,\r\n borderColor: theme.colors.border,\r\n borderRadius: theme.primitives.borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n height: 75,\r\n padding: 8,\r\n width: 225,\r\n },\r\n metricLabel: {\r\n color: theme.colors.mutedForeground,\r\n fontSize: 8,\r\n letterSpacing: 0.5,\r\n marginBottom: 2,\r\n textTransform: \"uppercase\",\r\n },\r\n metricTrend: {\r\n color: theme.colors.mutedForeground,\r\n fontSize: 9,\r\n },\r\n metricValue: {\r\n color: theme.colors.foreground,\r\n fontSize: 14,\r\n fontWeight: theme.primitives.fontWeights.bold,\r\n marginBottom: 2,\r\n },\r\n metricsGrid: {\r\n flexDirection: \"column\",\r\n gap: 8,\r\n },\r\n metricsRow: {\r\n flexDirection: \"row\",\r\n gap: 8,\r\n },\r\n page: {\r\n backgroundColor: theme.colors.background,\r\n },\r\n toolbar: {\r\n alignItems: \"center\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n marginBottom: 8,\r\n width: 499,\r\n },\r\n twoColumn: {\r\n alignItems: \"flex-start\",\r\n flexDirection: \"row\",\r\n gap: 10,\r\n },\r\n });\r\n\r\n return (\r\n <Document title={`${titlePrefix} ${data.period}`}>\r\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n <View style={styles.page as never}>\r\n <PageHeader\r\n variant=\"two-column\"\r\n title={data.title}\r\n subtitle={`${titlePrefix} · ${data.subtitle}`}\r\n rightText={data.period}\r\n rightSubText={`Generated ${data.generatedAt}`}\r\n marginBottom={14}\r\n />\r\n\r\n <View style={styles.toolbar}>\r\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\r\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\r\n Author: {data.author}\r\n </Text>\r\n </View>\r\n\r\n <Section variant=\"card\" padding=\"md\" noWrap>\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Executive Summary\r\n </Text>\r\n <View style={styles.metricsGrid}>\r\n {[0, 2].map((startIndex) => (\r\n <View key={startIndex} style={styles.metricsRow}>\r\n {data.summary\r\n .slice(startIndex, startIndex + 2)\r\n .map((metric) => (\r\n <View\r\n key={metric.label}\r\n style={\r\n {\r\n ...styles.metricCard,\r\n borderLeftColor: metric.tone\r\n ? toneColor(theme, metric.tone)\r\n : accent,\r\n borderLeftWidth: 3,\r\n } as never\r\n }\r\n >\r\n <Text style={styles.metricLabel} noMargin>\r\n {metric.label}\r\n </Text>\r\n <Text style={styles.metricValue} noMargin>\r\n {metric.value}\r\n </Text>\r\n {metric.trend ? (\r\n <Badge\r\n label={metric.trend}\r\n size=\"sm\"\r\n variant={metric.tone ?? \"info\"}\r\n style={{\r\n height: 16,\r\n width: metric.trend.endsWith(\"QoQ\")\r\n ? metric.trend.length * 6.5 + 10\r\n : metric.trend.length * 5 + 18,\r\n }}\r\n />\r\n ) : null}\r\n </View>\r\n ))}\r\n </View>\r\n ))}\r\n </View>\r\n </Section>\r\n </View>\r\n </Page>\r\n\r\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n <View style={styles.page as never}>\r\n <Section\r\n padding=\"md\"\r\n noWrap\r\n style={{\r\n position: \"relative\",\r\n top: sectionOffset[graphVariant],\r\n }}\r\n >\r\n <Text\r\n variant=\"sm\"\r\n transform=\"uppercase\"\r\n color=\"mutedForeground\"\r\n style={{\r\n position: \"relative\",\r\n top: titleOffset[graphVariant],\r\n }}\r\n >\r\n Performance Trend\r\n </Text>\r\n <View\r\n style={\r\n {\r\n ...styles.graphShell,\r\n paddingBottom: graphVariant === \"horizontal-bar\" ? 56 : 12,\r\n } as never\r\n }\r\n >\r\n <PdfGraph\r\n variant={graphVariant}\r\n data={graphData ?? data.series}\r\n title={graphTitle}\r\n subtitle={graphSubtitle}\r\n yLabel={undefined}\r\n xLabel={undefined}\r\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\r\n showValues={graphShowValues}\r\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\r\n legend={graphLegend}\r\n height={graphHeight[graphVariant]}\r\n colors={graphColors}\r\n fullWidth\r\n containerPadding={12}\r\n wrapperPadding={12}\r\n style={{ marginBottom: 0 }}\r\n />\r\n </View>\r\n </Section>\r\n\r\n <Section\r\n padding=\"md\"\r\n style={{\r\n position: \"relative\",\r\n top: deliveryOffset[graphVariant],\r\n }}\r\n >\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Delivery Table\r\n </Text>\r\n <DataTable\r\n variant=\"compact\"\r\n size=\"compact\"\r\n stripe\r\n columns={[\r\n { header: \"Stream\", key: \"label\" },\r\n { header: \"Owner\", key: \"owner\" },\r\n { align: \"center\", header: \"Status\", key: \"status\" },\r\n {\r\n align: \"right\",\r\n header: \"Progress\",\r\n key: \"progress\",\r\n render: (value) => `${String(value)}%`,\r\n },\r\n { align: \"right\", header: \"Risk\", key: \"risk\" },\r\n ]}\r\n data={data.rows}\r\n footer={{\r\n label: \"Totals\",\r\n owner: \"-\",\r\n progress: Math.round(\r\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\r\n Math.max(data.rows.length, 1)\r\n ),\r\n risk: \"-\",\r\n status: \"-\",\r\n }}\r\n />\r\n </Section>\r\n </View>\r\n </Page>\r\n\r\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n <View style={styles.page as never}>\r\n <Section padding=\"md\" variant=\"card\" noWrap>\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Highlights & Risks\r\n </Text>\r\n <View style={styles.twoColumn}>\r\n <View style={styles.col}>\r\n <PdfList\r\n variant=\"checklist\"\r\n items={data.highlights.map((item) => ({\r\n checked: true,\r\n text: item,\r\n }))}\r\n gap=\"sm\"\r\n />\r\n </View>\r\n <View style={styles.col}>\r\n <KeyValue\r\n size=\"sm\"\r\n divided\r\n items={[\r\n {\r\n key: \"Open Risks\",\r\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\r\n },\r\n {\r\n key: \"On-Track Streams\",\r\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\r\n },\r\n {\r\n key: \"Avg Progress\",\r\n value: `${Math.round(\r\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\r\n Math.max(data.rows.length, 1)\r\n )}%`,\r\n },\r\n ]}\r\n />\r\n </View>\r\n </View>\r\n </Section>\r\n </View>\r\n </Page>\r\n </Document>\r\n );\r\n};\r\n\r\nexport const ReportTemplateFrame = ({\r\n theme,\r\n data,\r\n titlePrefix,\r\n statusLabel,\r\n statusTone,\r\n graphVariant,\r\n graphTitle,\r\n graphSubtitle,\r\n graphLegend,\r\n graphShowValues,\r\n graphColors,\r\n graphData,\r\n}: ReportTemplateProps & {\r\n titlePrefix: string;\r\n statusLabel: string;\r\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n graphVariant: ReportGraphVariant;\r\n graphTitle: string;\r\n graphSubtitle: string;\r\n graphLegend?: \"bottom\" | \"right\" | \"none\";\r\n graphShowValues?: boolean;\r\n graphColors?: string[];\r\n graphData?: { label: string; value: number }[];\r\n}) => {\r\n if (!data) {\r\n return null;\r\n }\r\n\r\n return (\r\n <PdfcnThemeProvider theme={theme}>\r\n <ReportLayout\r\n data={data}\r\n titlePrefix={titlePrefix}\r\n statusLabel={statusLabel}\r\n statusTone={statusTone}\r\n graphVariant={graphVariant}\r\n graphTitle={graphTitle}\r\n graphSubtitle={graphSubtitle}\r\n graphLegend={graphLegend}\r\n graphShowValues={graphShowValues}\r\n graphColors={graphColors}\r\n graphData={graphData}\r\n />\r\n </PdfcnThemeProvider>\r\n );\r\n};\r\n",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { Badge } from \"@/components/pdf/badge/badge\";\nimport { DataTable } from \"@/components/pdf/data-table/data-table\";\nimport { PdfGraph } from \"@/components/pdf/graph/graph\";\nimport { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PdfList } from \"@/components/pdf/list/list\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { PageNumber } from \"@/components/pdf/page-number/page-number\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n const graphHeight: Record<ReportGraphVariant, number> = {\n area: 191,\n bar: 181,\n donut: 191,\n \"horizontal-bar\": 148,\n line: 191,\n pie: 191,\n };\n const deliveryOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 59,\n donut: -3,\n \"horizontal-bar\": -4,\n line: -30,\n pie: 0,\n };\n const sectionOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 32,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n const titleOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 0,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n\n const styles = StyleSheet.create({\n col: {\n width: 225,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n alignItems: \"flex-start\",\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n height: 75,\n padding: 8,\n width: 225,\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"column\",\n gap: 8,\n },\n metricsRow: {\n flexDirection: \"row\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n width: 499,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber align=\"right\" size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {[0, 2].map((startIndex) => (\n <View key={startIndex} style={styles.metricsRow}>\n {data.summary\n .slice(startIndex, startIndex + 2)\n .map((metric) => (\n <View\n key={metric.label}\n style={\n {\n ...styles.metricCard,\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n } as never\n }\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n style={{\n height: 16,\n width: metric.trend.endsWith(\"QoQ\")\n ? metric.trend.length * 6.5 + 10\n : metric.trend.length * 5 + 18,\n }}\n />\n ) : null}\n </View>\n ))}\n </View>\n ))}\n </View>\n </Section>\n </View>\n </Page>\n\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber align=\"right\" size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <Section\n padding=\"md\"\n noWrap\n style={{\n position: \"relative\",\n top: sectionOffset[graphVariant],\n }}\n >\n <Text\n variant=\"sm\"\n transform=\"uppercase\"\n color=\"mutedForeground\"\n style={{\n position: \"relative\",\n top: titleOffset[graphVariant],\n }}\n >\n Performance Trend\n </Text>\n <View\n style={\n {\n ...styles.graphShell,\n paddingBottom: graphVariant === \"horizontal-bar\" ? 56 : 12,\n } as never\n }\n >\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={graphHeight[graphVariant]}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section\n padding=\"md\"\n style={{\n position: \"relative\",\n top: deliveryOffset[graphVariant],\n }}\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n </View>\n </Page>\n\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber align=\"right\" size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Avg Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n </Section>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-operations/report-layout.tsx"
},
{
"path": "registry/bases/forme/blocks/report-operations/report-operations.tsx",
- "content": "import { ReportTemplateFrame } from \"./report-layout\";\r\nimport type { ReportTemplateProps } from \"./report-layout\";\r\nimport type { BaseReportData } from \"./report.types\";\r\n\r\nconst sampleOperationsData: BaseReportData = {\r\n author: \"Delivery Office\",\r\n generatedAt: \"February 23, 2026\",\r\n highlights: [\r\n \"SLA improved after shift rebalancing and incident triage changes.\",\r\n \"Backlog grew in week 4 due to release-related ticket surge.\",\r\n \"Incident queue remediation plan has executive sponsorship and budget.\",\r\n ],\r\n period: \"February 2026\",\r\n rows: [\r\n {\r\n label: \"L1 Support\",\r\n owner: \"N. Mehta\",\r\n progress: 91,\r\n risk: \"Low\",\r\n status: \"On Track\",\r\n },\r\n {\r\n label: \"L2 Support\",\r\n owner: \"D. Chen\",\r\n progress: 85,\r\n risk: \"Low\",\r\n status: \"On Track\",\r\n },\r\n {\r\n label: \"Incident Queue\",\r\n owner: \"R. Walker\",\r\n progress: 66,\r\n risk: \"High\",\r\n status: \"At Risk\",\r\n },\r\n {\r\n label: \"Automation Rollout\",\r\n owner: \"M. Roy\",\r\n progress: 77,\r\n risk: \"Medium\",\r\n status: \"On Track\",\r\n },\r\n ],\r\n series: [\r\n { label: \"W1\", value: 69 },\r\n { label: \"W2\", value: 71 },\r\n { label: \"W3\", value: 73 },\r\n { label: \"W4\", value: 74 },\r\n { label: \"W5\", value: 75 },\r\n { label: \"W6\", value: 76 },\r\n { label: \"W7\", value: 78 },\r\n { label: \"W8\", value: 79 },\r\n { label: \"W9\", value: 78 },\r\n { label: \"W10\", value: 80 },\r\n { label: \"W11\", value: 81 },\r\n { label: \"W12\", value: 83 },\r\n ],\r\n subtitle: \"Delivery throughput, SLA adherence, and backlog visibility\",\r\n summary: [\r\n {\r\n label: \"Tickets Closed\",\r\n tone: \"success\",\r\n trend: \"+9.8% MoM\",\r\n value: \"1,284\",\r\n },\r\n {\r\n label: \"SLA Hit Rate\",\r\n tone: \"success\",\r\n trend: \"+1.4 pts\",\r\n value: \"96.1%\",\r\n },\r\n { label: \"Backlog\", tone: \"warning\", trend: \"+6.0%\", value: \"214\" },\r\n { label: \"Escalations\", tone: \"success\", trend: \"-18.5%\", value: \"17\" },\r\n ],\r\n title: \"Monthly Operations Report\",\r\n};\r\n\r\nexport const OperationsReportDocument = ({\r\n theme,\r\n data = sampleOperationsData,\r\n}: ReportTemplateProps) => (\r\n <ReportTemplateFrame\r\n theme={theme}\r\n data={data}\r\n titlePrefix=\"Operations Report\"\r\n statusLabel=\"Ops: Watch\"\r\n statusTone=\"warning\"\r\n graphVariant=\"horizontal-bar\"\r\n graphTitle=\"Throughput by week\"\r\n graphSubtitle=\"Resolved workload distribution\"\r\n graphLegend=\"none\"\r\n graphShowValues\r\n graphColors={[\"#2563EB\"]}\r\n graphData={[\r\n { label: \"Incident\", value: 66 },\r\n { label: \"Automation\", value: 77 },\r\n { label: \"L2 Support\", value: 85 },\r\n { label: \"L1 Support\", value: 91 },\r\n ]}\r\n />\r\n);\r\n",
+ "content": "import { ReportTemplateFrame } from \"./report-layout\";\nimport type { ReportTemplateProps } from \"./report-layout\";\nimport type { BaseReportData } from \"./report.types\";\n\nconst sampleOperationsData: BaseReportData = {\n author: \"Delivery Office\",\n generatedAt: \"February 23, 2026\",\n highlights: [\n \"SLA improved after shift rebalancing and incident triage changes.\",\n \"Backlog grew in week 4 due to release-related ticket surge.\",\n \"Incident queue remediation plan has executive sponsorship and budget.\",\n ],\n period: \"February 2026\",\n rows: [\n {\n label: \"L1 Support\",\n owner: \"N. Mehta\",\n progress: 91,\n risk: \"Low\",\n status: \"On Track\",\n },\n {\n label: \"L2 Support\",\n owner: \"D. Chen\",\n progress: 85,\n risk: \"Low\",\n status: \"On Track\",\n },\n {\n label: \"Incident Queue\",\n owner: \"R. Walker\",\n progress: 66,\n risk: \"High\",\n status: \"At Risk\",\n },\n {\n label: \"Automation Rollout\",\n owner: \"M. Roy\",\n progress: 77,\n risk: \"Medium\",\n status: \"On Track\",\n },\n ],\n series: [\n { label: \"W1\", value: 69 },\n { label: \"W2\", value: 71 },\n { label: \"W3\", value: 73 },\n { label: \"W4\", value: 74 },\n { label: \"W5\", value: 75 },\n { label: \"W6\", value: 76 },\n { label: \"W7\", value: 78 },\n { label: \"W8\", value: 79 },\n { label: \"W9\", value: 78 },\n { label: \"W10\", value: 80 },\n { label: \"W11\", value: 81 },\n { label: \"W12\", value: 83 },\n ],\n subtitle: \"Delivery throughput, SLA adherence, and backlog visibility\",\n summary: [\n {\n label: \"Tickets Closed\",\n tone: \"success\",\n trend: \"+9.8% MoM\",\n value: \"1,284\",\n },\n {\n label: \"SLA Hit Rate\",\n tone: \"success\",\n trend: \"+1.4 pts\",\n value: \"96.1%\",\n },\n { label: \"Backlog\", tone: \"warning\", trend: \"+6.0%\", value: \"214\" },\n { label: \"Escalations\", tone: \"success\", trend: \"-18.5%\", value: \"17\" },\n ],\n title: \"Monthly Operations Report\",\n};\n\nexport const OperationsReportDocument = ({\n theme,\n data = sampleOperationsData,\n}: ReportTemplateProps) => (\n <ReportTemplateFrame\n theme={theme}\n data={data}\n titlePrefix=\"Operations Report\"\n statusLabel=\"Ops: Watch\"\n statusTone=\"warning\"\n graphVariant=\"horizontal-bar\"\n graphTitle=\"Throughput by week\"\n graphSubtitle=\"Resolved workload distribution\"\n graphLegend=\"none\"\n graphShowValues\n graphColors={[\"#2563EB\"]}\n graphData={[\n { label: \"Incident\", value: 66 },\n { label: \"Automation\", value: 77 },\n { label: \"L2 Support\", value: 85 },\n { label: \"L1 Support\", value: 91 },\n ]}\n />\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-operations/report-operations.tsx"
},
{
"path": "registry/bases/forme/blocks/report-operations/report.types.ts",
- "content": "export interface SummaryMetric {\r\n label: string;\r\n value: string;\r\n trend?: string;\r\n tone?: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n}\r\n\r\nexport type ReportRow = Record<string, unknown> & {\r\n label: string;\r\n owner: string;\r\n status: string;\r\n progress: number;\r\n risk?: string;\r\n};\r\n\r\nexport interface ReportSeriesPoint {\r\n label: string;\r\n value: number;\r\n}\r\n\r\nexport interface BaseReportData {\r\n title: string;\r\n subtitle: string;\r\n generatedAt: string;\r\n period: string;\r\n author: string;\r\n summary: SummaryMetric[];\r\n rows: ReportRow[];\r\n series: ReportSeriesPoint[];\r\n highlights: string[];\r\n}\r\n",
+ "content": "export interface SummaryMetric {\n label: string;\n value: string;\n trend?: string;\n tone?: \"success\" | \"warning\" | \"destructive\" | \"info\";\n}\n\nexport type ReportRow = Record<string, unknown> & {\n label: string;\n owner: string;\n status: string;\n progress: number;\n risk?: string;\n};\n\nexport interface ReportSeriesPoint {\n label: string;\n value: number;\n}\n\nexport interface BaseReportData {\n title: string;\n subtitle: string;\n generatedAt: string;\n period: string;\n author: string;\n summary: SummaryMetric[];\n rows: ReportRow[];\n series: ReportSeriesPoint[];\n highlights: string[];\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-operations/report.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/report-security.json b/apps/web/public/r/forme/report-security.json
index 74b0935..016adc9 100644
--- a/apps/web/public/r/forme/report-security.json
+++ b/apps/web/public/r/forme/report-security.json
@@ -14,6 +14,7 @@
"@pdfcn/forme/key-value",
"@pdfcn/forme/page-footer",
"@pdfcn/forme/page-header",
+ "@pdfcn/forme/page-number",
"@pdfcn/forme/graph",
"@pdfcn/forme/list",
"@pdfcn/forme/section",
@@ -22,22 +23,22 @@
"files": [
{
"path": "registry/bases/forme/blocks/report-security/report-layout.tsx",
- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\r\n\r\nimport { Badge } from \"@/registry/bases/forme/components/badge/badge\";\r\nimport { DataTable } from \"@/registry/bases/forme/components/data-table/data-table\";\r\nimport { PdfGraph } from \"@/registry/bases/forme/components/graph/graph\";\r\nimport { KeyValue } from \"@/registry/bases/forme/components/key-value/key-value\";\r\nimport { PdfList } from \"@/registry/bases/forme/components/list/list\";\r\nimport { PageFooter } from \"@/registry/bases/forme/components/page-footer/page-footer\";\r\nimport { PageHeader } from \"@/registry/bases/forme/components/page-header/page-header\";\r\nimport { Section } from \"@/registry/bases/forme/components/section/section\";\r\nimport { Text } from \"@/registry/bases/forme/components/text/text\";\r\nimport {\r\n PdfcnThemeProvider,\r\n usePdfcnTheme,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { BaseReportData } from \"./report.types\";\r\n\r\nexport interface ReportTemplateProps {\r\n theme?: PdfcnTheme;\r\n data?: BaseReportData;\r\n}\r\n\r\ntype ReportGraphVariant =\r\n | \"bar\"\r\n | \"horizontal-bar\"\r\n | \"line\"\r\n | \"area\"\r\n | \"pie\"\r\n | \"donut\";\r\n\r\ninterface ReportLayoutProps {\r\n data: BaseReportData;\r\n titlePrefix: string;\r\n statusLabel: string;\r\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n graphVariant: ReportGraphVariant;\r\n graphTitle: string;\r\n graphSubtitle: string;\r\n graphLegend?: \"bottom\" | \"right\" | \"none\";\r\n graphShowValues?: boolean;\r\n graphColors?: string[];\r\n graphData?: { label: string; value: number }[];\r\n}\r\n\r\nconst toneColor = (\r\n theme: PdfcnTheme,\r\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\r\n) => {\r\n if (tone === \"success\") {\r\n return theme.colors.success;\r\n }\r\n if (tone === \"warning\") {\r\n return theme.colors.warning;\r\n }\r\n if (tone === \"destructive\") {\r\n return theme.colors.destructive;\r\n }\r\n return theme.colors.info;\r\n};\r\n\r\nexport const ReportLayout = ({\r\n data,\r\n titlePrefix,\r\n statusLabel,\r\n statusTone,\r\n graphVariant,\r\n graphTitle,\r\n graphSubtitle,\r\n graphLegend = \"none\",\r\n graphShowValues = false,\r\n graphColors,\r\n graphData,\r\n}: ReportLayoutProps) => {\r\n const theme = usePdfcnTheme();\r\n const accent = toneColor(theme, statusTone);\r\n const graphHeight: Record<ReportGraphVariant, number> = {\r\n area: 191,\r\n bar: 181,\r\n donut: 191,\r\n \"horizontal-bar\": 148,\r\n line: 191,\r\n pie: 191,\r\n };\r\n const deliveryOffset: Record<ReportGraphVariant, number> = {\r\n area: 0,\r\n bar: 59,\r\n donut: -3,\r\n \"horizontal-bar\": -4,\r\n line: -30,\r\n pie: 0,\r\n };\r\n const sectionOffset: Record<ReportGraphVariant, number> = {\r\n area: 0,\r\n bar: 32,\r\n donut: 0,\r\n \"horizontal-bar\": 0,\r\n line: 0,\r\n pie: 0,\r\n };\r\n const titleOffset: Record<ReportGraphVariant, number> = {\r\n area: 0,\r\n bar: 0,\r\n donut: 0,\r\n \"horizontal-bar\": 0,\r\n line: 0,\r\n pie: 0,\r\n };\r\n\r\n const styles = StyleSheet.create({\r\n col: {\r\n width: 225,\r\n },\r\n graphShell: {\r\n backgroundColor: theme.colors.background,\r\n borderColor: theme.colors.border,\r\n borderRadius: theme.primitives.borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n padding: 12,\r\n },\r\n metricCard: {\r\n alignItems: \"flex-start\",\r\n backgroundColor: theme.colors.background,\r\n borderColor: theme.colors.border,\r\n borderRadius: theme.primitives.borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n height: 75,\r\n padding: 8,\r\n width: 225,\r\n },\r\n metricLabel: {\r\n color: theme.colors.mutedForeground,\r\n fontSize: 8,\r\n letterSpacing: 0.5,\r\n marginBottom: 2,\r\n textTransform: \"uppercase\",\r\n },\r\n metricTrend: {\r\n color: theme.colors.mutedForeground,\r\n fontSize: 9,\r\n },\r\n metricValue: {\r\n color: theme.colors.foreground,\r\n fontSize: 14,\r\n fontWeight: theme.primitives.fontWeights.bold,\r\n marginBottom: 2,\r\n },\r\n metricsGrid: {\r\n flexDirection: \"column\",\r\n gap: 8,\r\n },\r\n metricsRow: {\r\n flexDirection: \"row\",\r\n gap: 8,\r\n },\r\n page: {\r\n backgroundColor: theme.colors.background,\r\n },\r\n toolbar: {\r\n alignItems: \"center\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n marginBottom: 8,\r\n width: 499,\r\n },\r\n twoColumn: {\r\n alignItems: \"flex-start\",\r\n flexDirection: \"row\",\r\n gap: 10,\r\n },\r\n });\r\n\r\n return (\r\n <Document title={`${titlePrefix} ${data.period}`}>\r\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n <View style={styles.page as never}>\r\n <PageHeader\r\n variant=\"two-column\"\r\n title={data.title}\r\n subtitle={`${titlePrefix} · ${data.subtitle}`}\r\n rightText={data.period}\r\n rightSubText={`Generated ${data.generatedAt}`}\r\n marginBottom={14}\r\n />\r\n\r\n <View style={styles.toolbar}>\r\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\r\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\r\n Author: {data.author}\r\n </Text>\r\n </View>\r\n\r\n <Section variant=\"card\" padding=\"md\" noWrap>\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Executive Summary\r\n </Text>\r\n <View style={styles.metricsGrid}>\r\n {[0, 2].map((startIndex) => (\r\n <View key={startIndex} style={styles.metricsRow}>\r\n {data.summary\r\n .slice(startIndex, startIndex + 2)\r\n .map((metric) => (\r\n <View\r\n key={metric.label}\r\n style={\r\n {\r\n ...styles.metricCard,\r\n borderLeftColor: metric.tone\r\n ? toneColor(theme, metric.tone)\r\n : accent,\r\n borderLeftWidth: 3,\r\n } as never\r\n }\r\n >\r\n <Text style={styles.metricLabel} noMargin>\r\n {metric.label}\r\n </Text>\r\n <Text style={styles.metricValue} noMargin>\r\n {metric.value}\r\n </Text>\r\n {metric.trend ? (\r\n <Badge\r\n label={metric.trend}\r\n size=\"sm\"\r\n variant={metric.tone ?? \"info\"}\r\n style={{\r\n height: 16,\r\n width: metric.trend.endsWith(\"QoQ\")\r\n ? metric.trend.length * 6.5 + 10\r\n : metric.trend.length * 5 + 18,\r\n }}\r\n />\r\n ) : null}\r\n </View>\r\n ))}\r\n </View>\r\n ))}\r\n </View>\r\n </Section>\r\n </View>\r\n </Page>\r\n\r\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n <View style={styles.page as never}>\r\n <Section\r\n padding=\"md\"\r\n noWrap\r\n style={{\r\n position: \"relative\",\r\n top: sectionOffset[graphVariant],\r\n }}\r\n >\r\n <Text\r\n variant=\"sm\"\r\n transform=\"uppercase\"\r\n color=\"mutedForeground\"\r\n style={{\r\n position: \"relative\",\r\n top: titleOffset[graphVariant],\r\n }}\r\n >\r\n Performance Trend\r\n </Text>\r\n <View\r\n style={\r\n {\r\n ...styles.graphShell,\r\n paddingBottom: graphVariant === \"horizontal-bar\" ? 56 : 12,\r\n } as never\r\n }\r\n >\r\n <PdfGraph\r\n variant={graphVariant}\r\n data={graphData ?? data.series}\r\n title={graphTitle}\r\n subtitle={graphSubtitle}\r\n yLabel={undefined}\r\n xLabel={undefined}\r\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\r\n showValues={graphShowValues}\r\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\r\n legend={graphLegend}\r\n height={graphHeight[graphVariant]}\r\n colors={graphColors}\r\n fullWidth\r\n containerPadding={12}\r\n wrapperPadding={12}\r\n style={{ marginBottom: 0 }}\r\n />\r\n </View>\r\n </Section>\r\n\r\n <Section\r\n padding=\"md\"\r\n style={{\r\n position: \"relative\",\r\n top: deliveryOffset[graphVariant],\r\n }}\r\n >\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Delivery Table\r\n </Text>\r\n <DataTable\r\n variant=\"compact\"\r\n size=\"compact\"\r\n stripe\r\n columns={[\r\n { header: \"Stream\", key: \"label\" },\r\n { header: \"Owner\", key: \"owner\" },\r\n { align: \"center\", header: \"Status\", key: \"status\" },\r\n {\r\n align: \"right\",\r\n header: \"Progress\",\r\n key: \"progress\",\r\n render: (value) => `${String(value)}%`,\r\n },\r\n { align: \"right\", header: \"Risk\", key: \"risk\" },\r\n ]}\r\n data={data.rows}\r\n footer={{\r\n label: \"Totals\",\r\n owner: \"-\",\r\n progress: Math.round(\r\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\r\n Math.max(data.rows.length, 1)\r\n ),\r\n risk: \"-\",\r\n status: \"-\",\r\n }}\r\n />\r\n </Section>\r\n </View>\r\n </Page>\r\n\r\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n <View style={styles.page as never}>\r\n <Section padding=\"md\" variant=\"card\" noWrap>\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Highlights & Risks\r\n </Text>\r\n <View style={styles.twoColumn}>\r\n <View style={styles.col}>\r\n <PdfList\r\n variant=\"checklist\"\r\n items={data.highlights.map((item) => ({\r\n checked: true,\r\n text: item,\r\n }))}\r\n gap=\"sm\"\r\n />\r\n </View>\r\n <View style={styles.col}>\r\n <KeyValue\r\n size=\"sm\"\r\n divided\r\n items={[\r\n {\r\n key: \"Open Risks\",\r\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\r\n },\r\n {\r\n key: \"On-Track Streams\",\r\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\r\n },\r\n {\r\n key: \"Avg Progress\",\r\n value: `${Math.round(\r\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\r\n Math.max(data.rows.length, 1)\r\n )}%`,\r\n },\r\n ]}\r\n />\r\n </View>\r\n </View>\r\n </Section>\r\n </View>\r\n </Page>\r\n </Document>\r\n );\r\n};\r\n\r\nexport const ReportTemplateFrame = ({\r\n theme,\r\n data,\r\n titlePrefix,\r\n statusLabel,\r\n statusTone,\r\n graphVariant,\r\n graphTitle,\r\n graphSubtitle,\r\n graphLegend,\r\n graphShowValues,\r\n graphColors,\r\n graphData,\r\n}: ReportTemplateProps & {\r\n titlePrefix: string;\r\n statusLabel: string;\r\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n graphVariant: ReportGraphVariant;\r\n graphTitle: string;\r\n graphSubtitle: string;\r\n graphLegend?: \"bottom\" | \"right\" | \"none\";\r\n graphShowValues?: boolean;\r\n graphColors?: string[];\r\n graphData?: { label: string; value: number }[];\r\n}) => {\r\n if (!data) {\r\n return null;\r\n }\r\n\r\n return (\r\n <PdfcnThemeProvider theme={theme}>\r\n <ReportLayout\r\n data={data}\r\n titlePrefix={titlePrefix}\r\n statusLabel={statusLabel}\r\n statusTone={statusTone}\r\n graphVariant={graphVariant}\r\n graphTitle={graphTitle}\r\n graphSubtitle={graphSubtitle}\r\n graphLegend={graphLegend}\r\n graphShowValues={graphShowValues}\r\n graphColors={graphColors}\r\n graphData={graphData}\r\n />\r\n </PdfcnThemeProvider>\r\n );\r\n};\r\n",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { Badge } from \"@/components/pdf/badge/badge\";\nimport { DataTable } from \"@/components/pdf/data-table/data-table\";\nimport { PdfGraph } from \"@/components/pdf/graph/graph\";\nimport { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PdfList } from \"@/components/pdf/list/list\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { PageNumber } from \"@/components/pdf/page-number/page-number\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n const graphHeight: Record<ReportGraphVariant, number> = {\n area: 191,\n bar: 181,\n donut: 191,\n \"horizontal-bar\": 148,\n line: 191,\n pie: 191,\n };\n const deliveryOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 59,\n donut: -3,\n \"horizontal-bar\": -4,\n line: -30,\n pie: 0,\n };\n const sectionOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 32,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n const titleOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 0,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n\n const styles = StyleSheet.create({\n col: {\n width: 225,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n alignItems: \"flex-start\",\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n height: 75,\n padding: 8,\n width: 225,\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"column\",\n gap: 8,\n },\n metricsRow: {\n flexDirection: \"row\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n width: 499,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber align=\"right\" size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {[0, 2].map((startIndex) => (\n <View key={startIndex} style={styles.metricsRow}>\n {data.summary\n .slice(startIndex, startIndex + 2)\n .map((metric) => (\n <View\n key={metric.label}\n style={\n {\n ...styles.metricCard,\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n } as never\n }\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n style={{\n height: 16,\n width: metric.trend.endsWith(\"QoQ\")\n ? metric.trend.length * 6.5 + 10\n : metric.trend.length * 5 + 18,\n }}\n />\n ) : null}\n </View>\n ))}\n </View>\n ))}\n </View>\n </Section>\n </View>\n </Page>\n\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber align=\"right\" size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <Section\n padding=\"md\"\n noWrap\n style={{\n position: \"relative\",\n top: sectionOffset[graphVariant],\n }}\n >\n <Text\n variant=\"sm\"\n transform=\"uppercase\"\n color=\"mutedForeground\"\n style={{\n position: \"relative\",\n top: titleOffset[graphVariant],\n }}\n >\n Performance Trend\n </Text>\n <View\n style={\n {\n ...styles.graphShell,\n paddingBottom: graphVariant === \"horizontal-bar\" ? 56 : 12,\n } as never\n }\n >\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={graphHeight[graphVariant]}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section\n padding=\"md\"\n style={{\n position: \"relative\",\n top: deliveryOffset[graphVariant],\n }}\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n </View>\n </Page>\n\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber align=\"right\" size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Avg Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n </Section>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-security/report-layout.tsx"
},
{
"path": "registry/bases/forme/blocks/report-security/report-security.tsx",
- "content": "import { ReportTemplateFrame } from \"./report-layout\";\r\nimport type { ReportTemplateProps } from \"./report-layout\";\r\nimport type { BaseReportData } from \"./report.types\";\r\n\r\nconst sampleSecurityData: BaseReportData = {\r\n author: \"Security Engineering\",\r\n generatedAt: \"February 23, 2026\",\r\n highlights: [\r\n \"Critical vulnerabilities reduced through mandatory patch windows.\",\r\n \"Secrets rotation remains the highest-risk stream and needs additional staffing.\",\r\n \"External penetration test scheduled for next sprint to validate fixes.\",\r\n ],\r\n period: \"Sprint 05, 2026\",\r\n rows: [\r\n {\r\n label: \"Identity Hardening\",\r\n owner: \"E. Brown\",\r\n progress: 87,\r\n risk: \"Low\",\r\n status: \"On Track\",\r\n },\r\n {\r\n label: \"Secrets Rotation\",\r\n owner: \"P. Nair\",\r\n progress: 58,\r\n risk: \"High\",\r\n status: \"At Risk\",\r\n },\r\n {\r\n label: \"Dependency Scanning\",\r\n owner: \"I. Shah\",\r\n progress: 81,\r\n risk: \"Medium\",\r\n status: \"On Track\",\r\n },\r\n {\r\n label: \"WAF Policy\",\r\n owner: \"S. Reed\",\r\n progress: 76,\r\n risk: \"Low\",\r\n status: \"On Track\",\r\n },\r\n ],\r\n series: [\r\n { label: \"W1\", value: 61 },\r\n { label: \"W2\", value: 63 },\r\n { label: \"W3\", value: 64 },\r\n { label: \"W4\", value: 66 },\r\n { label: \"W5\", value: 67 },\r\n { label: \"W6\", value: 68 },\r\n { label: \"W7\", value: 69 },\r\n { label: \"W8\", value: 71 },\r\n { label: \"W9\", value: 72 },\r\n { label: \"W10\", value: 74 },\r\n { label: \"W11\", value: 76 },\r\n { label: \"W12\", value: 78 },\r\n ],\r\n subtitle: \"Vulnerability trends, control maturity, and remediation health\",\r\n summary: [\r\n {\r\n label: \"Critical Vulns\",\r\n tone: \"success\",\r\n trend: \"-3 from last sprint\",\r\n value: \"2\",\r\n },\r\n { label: \"Patch SLA\", tone: \"success\", trend: \"+5.3 pts\", value: \"92.0%\" },\r\n { label: \"Open Findings\", tone: \"warning\", trend: \"+4\", value: \"41\" },\r\n { label: \"Control Score\", tone: \"info\", trend: \"+2 pts\", value: \"84/100\" },\r\n ],\r\n title: \"Security Posture Report\",\r\n};\r\n\r\nexport const SecurityReportDocument = ({\r\n theme,\r\n data = sampleSecurityData,\r\n}: ReportTemplateProps) => (\r\n <ReportTemplateFrame\r\n theme={theme}\r\n data={data}\r\n titlePrefix=\"Security Report\"\r\n statusLabel=\"Security: Action Needed\"\r\n statusTone=\"destructive\"\r\n graphVariant=\"donut\"\r\n graphTitle=\"Open risk distribution\"\r\n graphSubtitle=\"High/Medium/Low workload share\"\r\n graphLegend=\"right\"\r\n graphShowValues\r\n graphColors={[\"#DC2626\", \"#F59E0B\", \"#16A34A\", \"#0EA5E9\"]}\r\n graphData={[\r\n { label: \"High Risk\", value: 14 },\r\n { label: \"Medium Risk\", value: 17 },\r\n { label: \"Low Risk\", value: 8 },\r\n { label: \"Info\", value: 4 },\r\n ]}\r\n />\r\n);\r\n",
+ "content": "import { ReportTemplateFrame } from \"./report-layout\";\nimport type { ReportTemplateProps } from \"./report-layout\";\nimport type { BaseReportData } from \"./report.types\";\n\nconst sampleSecurityData: BaseReportData = {\n author: \"Security Engineering\",\n generatedAt: \"February 23, 2026\",\n highlights: [\n \"Critical vulnerabilities reduced through mandatory patch windows.\",\n \"Secrets rotation remains the highest-risk stream and needs additional staffing.\",\n \"External penetration test scheduled for next sprint to validate fixes.\",\n ],\n period: \"Sprint 05, 2026\",\n rows: [\n {\n label: \"Identity Hardening\",\n owner: \"E. Brown\",\n progress: 87,\n risk: \"Low\",\n status: \"On Track\",\n },\n {\n label: \"Secrets Rotation\",\n owner: \"P. Nair\",\n progress: 58,\n risk: \"High\",\n status: \"At Risk\",\n },\n {\n label: \"Dependency Scanning\",\n owner: \"I. Shah\",\n progress: 81,\n risk: \"Medium\",\n status: \"On Track\",\n },\n {\n label: \"WAF Policy\",\n owner: \"S. Reed\",\n progress: 76,\n risk: \"Low\",\n status: \"On Track\",\n },\n ],\n series: [\n { label: \"W1\", value: 61 },\n { label: \"W2\", value: 63 },\n { label: \"W3\", value: 64 },\n { label: \"W4\", value: 66 },\n { label: \"W5\", value: 67 },\n { label: \"W6\", value: 68 },\n { label: \"W7\", value: 69 },\n { label: \"W8\", value: 71 },\n { label: \"W9\", value: 72 },\n { label: \"W10\", value: 74 },\n { label: \"W11\", value: 76 },\n { label: \"W12\", value: 78 },\n ],\n subtitle: \"Vulnerability trends, control maturity, and remediation health\",\n summary: [\n {\n label: \"Critical Vulns\",\n tone: \"success\",\n trend: \"-3 from last sprint\",\n value: \"2\",\n },\n { label: \"Patch SLA\", tone: \"success\", trend: \"+5.3 pts\", value: \"92.0%\" },\n { label: \"Open Findings\", tone: \"warning\", trend: \"+4\", value: \"41\" },\n { label: \"Control Score\", tone: \"info\", trend: \"+2 pts\", value: \"84/100\" },\n ],\n title: \"Security Posture Report\",\n};\n\nexport const SecurityReportDocument = ({\n theme,\n data = sampleSecurityData,\n}: ReportTemplateProps) => (\n <ReportTemplateFrame\n theme={theme}\n data={data}\n titlePrefix=\"Security Report\"\n statusLabel=\"Security: Action Needed\"\n statusTone=\"destructive\"\n graphVariant=\"donut\"\n graphTitle=\"Open risk distribution\"\n graphSubtitle=\"High/Medium/Low workload share\"\n graphLegend=\"right\"\n graphShowValues\n graphColors={[\"#DC2626\", \"#F59E0B\", \"#16A34A\", \"#0EA5E9\"]}\n graphData={[\n { label: \"High Risk\", value: 14 },\n { label: \"Medium Risk\", value: 17 },\n { label: \"Low Risk\", value: 8 },\n { label: \"Info\", value: 4 },\n ]}\n />\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-security/report-security.tsx"
},
{
"path": "registry/bases/forme/blocks/report-security/report.types.ts",
- "content": "export interface SummaryMetric {\r\n label: string;\r\n value: string;\r\n trend?: string;\r\n tone?: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n}\r\n\r\nexport type ReportRow = Record<string, unknown> & {\r\n label: string;\r\n owner: string;\r\n status: string;\r\n progress: number;\r\n risk?: string;\r\n};\r\n\r\nexport interface ReportSeriesPoint {\r\n label: string;\r\n value: number;\r\n}\r\n\r\nexport interface BaseReportData {\r\n title: string;\r\n subtitle: string;\r\n generatedAt: string;\r\n period: string;\r\n author: string;\r\n summary: SummaryMetric[];\r\n rows: ReportRow[];\r\n series: ReportSeriesPoint[];\r\n highlights: string[];\r\n}\r\n",
+ "content": "export interface SummaryMetric {\n label: string;\n value: string;\n trend?: string;\n tone?: \"success\" | \"warning\" | \"destructive\" | \"info\";\n}\n\nexport type ReportRow = Record<string, unknown> & {\n label: string;\n owner: string;\n status: string;\n progress: number;\n risk?: string;\n};\n\nexport interface ReportSeriesPoint {\n label: string;\n value: number;\n}\n\nexport interface BaseReportData {\n title: string;\n subtitle: string;\n generatedAt: string;\n period: string;\n author: string;\n summary: SummaryMetric[];\n rows: ReportRow[];\n series: ReportSeriesPoint[];\n highlights: string[];\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-security/report.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/section.json b/apps/web/public/r/forme/section.json
index 93e9221..85a4493 100644
--- a/apps/web/public/r/forme/section.json
+++ b/apps/web/public/r/forme/section.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/forme/components/section/section.tsx",
- "content": "import {\r\n mergePdfStyles,\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport { StyleSheet, View } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type SectionSpacing = \"none\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\r\nexport type SectionPadding = \"none\" | \"sm\" | \"md\" | \"lg\";\r\nexport type SectionVariant = \"default\" | \"callout\" | \"highlight\" | \"card\";\r\n\r\n/**\r\n * Layout container with spacing, padding, and visual style variants.\r\n * Props - `spacing` | `padding` | `background` | `border` | `variant` | `accentColor` | `noWrap` | `children` | `style`\r\n * @see {@link SectionProps}\r\n */\r\nexport interface SectionProps extends PDFComponentProps {\r\n /**\r\n * @default 'md'\r\n */\r\n spacing?: SectionSpacing;\r\n padding?: SectionPadding;\r\n background?: string;\r\n /**\r\n * @default false\r\n */\r\n border?: boolean;\r\n /**\r\n * @default 'default'\r\n */\r\n variant?: SectionVariant;\r\n accentColor?: string;\r\n /**\r\n * @default false\r\n */\r\n noWrap?: boolean;\r\n}\r\n\r\nconst createSectionStyles = (t: PdfcnTheme) => {\r\n const { spacing, borderRadius } = t.primitives;\r\n return StyleSheet.create({\r\n base: { flexDirection: \"column\" },\r\n border: {\r\n borderColor: t.colors.border,\r\n borderRadius: borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: spacing[0.5],\r\n },\r\n callout: {\r\n borderLeftColor: t.colors.primary,\r\n borderLeftStyle: \"solid\",\r\n borderLeftWidth: spacing[1],\r\n paddingLeft: spacing[4],\r\n paddingVertical: spacing[2],\r\n },\r\n card: {\r\n borderColor: t.colors.border,\r\n borderRadius: borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: spacing[0.5],\r\n padding: spacing[4],\r\n },\r\n highlight: {\r\n backgroundColor: t.colors.muted,\r\n borderLeftColor: t.colors.primary,\r\n borderLeftStyle: \"solid\",\r\n borderLeftWidth: spacing[1],\r\n padding: spacing[4],\r\n },\r\n paddingLg: { padding: spacing[6] },\r\n paddingMd: { padding: spacing[4] },\r\n paddingNone: { padding: spacing[0] },\r\n paddingSm: { padding: spacing[3] },\r\n spacingLg: { marginVertical: spacing[8] },\r\n spacingMd: { marginVertical: t.spacing.sectionGap },\r\n spacingNone: { marginVertical: spacing[0] },\r\n spacingSm: { marginVertical: spacing[4] },\r\n spacingXl: { marginVertical: spacing[12] },\r\n });\r\n};\r\n\r\nexport const Section = ({\r\n spacing = \"md\",\r\n padding,\r\n background,\r\n border,\r\n variant = \"default\",\r\n accentColor,\r\n noWrap = false,\r\n children,\r\n style,\r\n}: SectionProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createSectionStyles(theme), [theme]);\r\n const spacingMap = {\r\n lg: styles.spacingLg,\r\n md: styles.spacingMd,\r\n none: styles.spacingNone,\r\n sm: styles.spacingSm,\r\n xl: styles.spacingXl,\r\n };\r\n const paddingMap = {\r\n lg: styles.paddingLg,\r\n md: styles.paddingMd,\r\n none: styles.paddingNone,\r\n sm: styles.paddingSm,\r\n };\r\n const variantMap: Record<SectionVariant, Style | null> = {\r\n callout: styles.callout,\r\n card: styles.card,\r\n default: null,\r\n highlight: styles.highlight,\r\n };\r\n const styleArray: Style[] = [styles.base, spacingMap[spacing]];\r\n const variantStyle = variantMap[variant];\r\n if (variantStyle) {\r\n styleArray.push(variantStyle);\r\n }\r\n if (accentColor && (variant === \"callout\" || variant === \"highlight\")) {\r\n styleArray.push({\r\n borderLeftColor: resolveColor(accentColor, theme.colors),\r\n });\r\n }\r\n if (padding && padding in paddingMap) {\r\n styleArray.push(paddingMap[padding]);\r\n }\r\n if (border && variant === \"default\") {\r\n styleArray.push(styles.border);\r\n }\r\n if (background) {\r\n styleArray.push({\r\n backgroundColor: resolveColor(background, theme.colors),\r\n });\r\n }\r\n if (style) {\r\n styleArray.push(...[style].flat());\r\n }\r\n return (\r\n <View wrap={noWrap ? false : undefined} style={mergePdfStyles(styleArray)}>\r\n {children}\r\n </View>\r\n );\r\n};\r\n",
+ "content": "import {\n mergePdfStyles,\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport { StyleSheet, View } from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type SectionSpacing = \"none\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type SectionPadding = \"none\" | \"sm\" | \"md\" | \"lg\";\nexport type SectionVariant = \"default\" | \"callout\" | \"highlight\" | \"card\";\n\n/**\n * Layout container with spacing, padding, and visual style variants.\n * Props - `spacing` | `padding` | `background` | `border` | `variant` | `accentColor` | `noWrap` | `children` | `style`\n * @see {@link SectionProps}\n */\nexport interface SectionProps extends PDFComponentProps {\n /**\n * @default 'md'\n */\n spacing?: SectionSpacing;\n padding?: SectionPadding;\n background?: string;\n /**\n * @default false\n */\n border?: boolean;\n /**\n * @default 'default'\n */\n variant?: SectionVariant;\n accentColor?: string;\n /**\n * @default false\n */\n noWrap?: boolean;\n}\n\nconst createSectionStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius } = t.primitives;\n return StyleSheet.create({\n base: { flexDirection: \"column\" },\n border: {\n borderColor: t.colors.border,\n borderRadius: borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: spacing[0.5],\n },\n callout: {\n borderLeftColor: t.colors.primary,\n borderLeftStyle: \"solid\",\n borderLeftWidth: spacing[1],\n paddingLeft: spacing[4],\n paddingVertical: spacing[2],\n },\n card: {\n borderColor: t.colors.border,\n borderRadius: borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: spacing[0.5],\n padding: spacing[4],\n },\n highlight: {\n backgroundColor: t.colors.muted,\n borderLeftColor: t.colors.primary,\n borderLeftStyle: \"solid\",\n borderLeftWidth: spacing[1],\n padding: spacing[4],\n },\n paddingLg: { padding: spacing[6] },\n paddingMd: { padding: spacing[4] },\n paddingNone: { padding: spacing[0] },\n paddingSm: { padding: spacing[3] },\n spacingLg: { marginVertical: spacing[8] },\n spacingMd: { marginVertical: t.spacing.sectionGap },\n spacingNone: { marginVertical: spacing[0] },\n spacingSm: { marginVertical: spacing[4] },\n spacingXl: { marginVertical: spacing[12] },\n });\n};\n\nexport const Section = ({\n spacing = \"md\",\n padding,\n background,\n border,\n variant = \"default\",\n accentColor,\n noWrap = false,\n children,\n style,\n}: SectionProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createSectionStyles(theme), [theme]);\n const spacingMap = {\n lg: styles.spacingLg,\n md: styles.spacingMd,\n none: styles.spacingNone,\n sm: styles.spacingSm,\n xl: styles.spacingXl,\n };\n const paddingMap = {\n lg: styles.paddingLg,\n md: styles.paddingMd,\n none: styles.paddingNone,\n sm: styles.paddingSm,\n };\n const variantMap: Record<SectionVariant, Style | null> = {\n callout: styles.callout,\n card: styles.card,\n default: null,\n highlight: styles.highlight,\n };\n const styleArray: Style[] = [styles.base, spacingMap[spacing]];\n const variantStyle = variantMap[variant];\n if (variantStyle) {\n styleArray.push(variantStyle);\n }\n if (accentColor && (variant === \"callout\" || variant === \"highlight\")) {\n styleArray.push({\n borderLeftColor: resolveColor(accentColor, theme.colors),\n });\n }\n if (padding && padding in paddingMap) {\n styleArray.push(paddingMap[padding]);\n }\n if (border && variant === \"default\") {\n styleArray.push(styles.border);\n }\n if (background) {\n styleArray.push({\n backgroundColor: resolveColor(background, theme.colors),\n });\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return (\n <View wrap={noWrap ? false : undefined} style={mergePdfStyles(styleArray)}>\n {children}\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/section/section.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/shipping-label.json b/apps/web/public/r/forme/shipping-label.json
index fb8a0fd..0d6cb8c 100644
--- a/apps/web/public/r/forme/shipping-label.json
+++ b/apps/web/public/r/forme/shipping-label.json
@@ -16,7 +16,7 @@
"files": [
{
"path": "registry/bases/forme/blocks/shipping-label/shipping-label.tsx",
- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { PdfQRCode } from \"@/registry/bases/forme/components/qrcode/qrcode\";\nimport { Text } from \"@/registry/bases/forme/components/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport { Image } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type {\n ShippingLabelAddress,\n ShippingLabelData,\n} from \"./shipping-label.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: ShippingLabelData = {\n carrier: \"UPS\",\n dimensions: '12\" x 8\" x 6\"',\n from: {\n address: \"456 Industrial Blvd\",\n city: \"Los Angeles\",\n country: \"USA\",\n name: \"ACME Corporation\",\n state: \"CA\",\n zip: \"90001\",\n },\n handlingLabels: [\"FRAGILE\", \"THIS SIDE UP\"],\n packageCount: 1,\n postage: \"$18.40\",\n serviceLevel: \"Ground\",\n to: {\n address: \"123 Main Street, Apt 4B\",\n city: \"New York\",\n country: \"USA\",\n name: \"John Doe\",\n phone: \"(503) 555-0142\",\n state: \"NY\",\n zip: \"10001\",\n },\n trackingNumber: \"TRACK123456789US\",\n weight: \"2.5 kg\",\n};\n\n// Standard 4\" x 6\" shipping label, expressed in PDF points (72 dpi)\nconst LABEL_SIZE = { height: 432, width: 288 };\n\n// Quiet zone kept clear of the printed label frame, plus the frame itself\nconst LABEL_MARGIN = 8;\nconst LABEL_BORDER = 2;\nconst LABEL_PADDING = 10;\n\n// Forme scales an image with the Image element's own width/height (style\n// dimensions only size the box), so the barcode is measured in points from\n// the label's content box instead of a percentage width.\nconst BARCODE_WIDTH =\n LABEL_SIZE.width - 2 * (LABEL_MARGIN + LABEL_BORDER + LABEL_PADDING);\nconst BARCODE_HEIGHT = 72;\n\nconst formatCityLine = (party: ShippingLabelAddress) => {\n const cityStateZip = `${party.city}, ${party.state} ${party.zip}`;\n return party.country ? `${cityStateZip}, ${party.country}` : cityStateZip;\n};\n\n// Shared address block — same treatment for both parties (10pt, bold name).\n// Forme's serializer drops components that return a Fragment, so the lines are\n// wrapped in a View; inside the column parent the stacking is identical.\nconst AddressLines = ({\n party,\n}: {\n party: ShippingLabelAddress & { phone?: string };\n}) => (\n <View>\n <Text noMargin variant=\"xs\" weight=\"bold\">\n {party.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {party.address}\n </Text>\n <Text noMargin variant=\"xs\">\n {formatCityLine(party)}\n </Text>\n {party.phone && (\n <Text noMargin variant=\"xs\" color=\"mutedForeground\">\n {party.phone}\n </Text>\n )}\n </View>\n);\n\nconst ShippingLabelContent = ({ data }: { data: ShippingLabelData }) => {\n const theme = usePdfcnTheme();\n\n const accent = resolveColor(\n data.accentColor ?? theme.colors.primary,\n theme.colors\n );\n\n const detailRows = [\n ...(data.weight ? [{ key: \"Weight\", value: data.weight }] : []),\n ...(data.dimensions ? [{ key: \"Dimensions\", value: data.dimensions }] : []),\n ...(typeof data.packageCount === \"number\"\n ? [{ key: \"Packages\", value: `${data.packageCount}` }]\n : []),\n { key: \"Postage\", value: data.postage ?? \"PAID\" },\n ];\n\n const styles = StyleSheet.create({\n addresses: { flex: 1, flexDirection: \"row\" },\n badgesRow: {\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 6,\n marginTop: 8,\n },\n barcodeArea: { alignItems: \"center\", marginTop: 10 },\n carrierName: { fontSize: 16, fontWeight: \"bold\" },\n fromColumn: { flex: 1, paddingLeft: 12 },\n handlingTag: {\n alignItems: \"center\",\n backgroundColor: theme.colors.foreground,\n justifyContent: \"center\",\n paddingHorizontal: 8,\n paddingVertical: 4,\n },\n handlingTagText: {\n color: theme.colors.background,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 1,\n textTransform: \"uppercase\",\n },\n headerRow: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n },\n label: {\n borderColor: theme.colors.foreground,\n borderWidth: LABEL_BORDER,\n flex: 1,\n padding: LABEL_PADDING,\n },\n page: {\n backgroundColor: theme.colors.background,\n flex: 1,\n flexDirection: \"column\",\n height: LABEL_SIZE.height - LABEL_MARGIN * 2,\n overflow: \"hidden\",\n },\n rule: {\n backgroundColor: theme.colors.foreground,\n height: 2,\n marginVertical: 6,\n },\n sectionLabel: {\n color: accent,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 1,\n marginBottom: 4,\n textTransform: \"uppercase\",\n },\n serviceRight: { alignItems: \"flex-end\" },\n shipToColumn: {\n borderRightColor: theme.colors.foreground,\n borderRightWidth: 2,\n flex: 1.4,\n paddingRight: 12,\n },\n table: {\n borderColor: theme.colors.foreground,\n borderWidth: 2,\n },\n tableKey: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.5,\n textTransform: \"uppercase\",\n width: 84,\n },\n tableRow: {\n alignItems: \"center\",\n borderBottomColor: theme.colors.border,\n borderBottomWidth: 1,\n flexDirection: \"row\",\n paddingHorizontal: 8,\n paddingVertical: 3,\n },\n tableRowLast: {\n alignItems: \"center\",\n flexDirection: \"row\",\n paddingHorizontal: 8,\n paddingVertical: 3,\n },\n tableValue: { flex: 1 },\n trackingText: {\n fontWeight: \"bold\",\n letterSpacing: 2,\n marginTop: 6,\n textTransform: \"uppercase\",\n },\n });\n\n return (\n <Document title={`Shipping Label ${data.trackingNumber}`}>\n <Page size={LABEL_SIZE} margin={LABEL_MARGIN}>\n <View style={styles.page as never}>\n <View style={styles.label}>\n <View style={styles.headerRow}>\n <Text noMargin style={styles.carrierName}>\n {data.carrier}\n </Text>\n <View style={styles.serviceRight}>\n <Text noMargin style={styles.sectionLabel}>\n {data.serviceLevel}\n </Text>\n </View>\n </View>\n\n <View style={styles.rule} />\n\n <View style={styles.addresses}>\n <View style={styles.shipToColumn}>\n <Text noMargin style={styles.sectionLabel}>\n Ship To\n </Text>\n <AddressLines party={data.to} />\n </View>\n <View style={styles.fromColumn}>\n <Text noMargin style={styles.sectionLabel}>\n From\n </Text>\n <AddressLines party={data.from} />\n </View>\n </View>\n\n <View style={styles.rule} />\n\n <View style={styles.table}>\n {detailRows.map((row, index) => (\n <View\n key={row.key}\n style={\n index === detailRows.length - 1\n ? styles.tableRowLast\n : styles.tableRow\n }\n >\n <Text noMargin style={styles.tableKey}>\n {row.key}\n </Text>\n <Text noMargin style={styles.tableValue} variant=\"xs\">\n {row.value}\n </Text>\n </View>\n ))}\n </View>\n\n {data.handlingLabels && data.handlingLabels.length > 0 && (\n <View style={styles.badgesRow}>\n {data.handlingLabels.map((label, index) => (\n <View key={`${label}-${index}`} style={styles.handlingTag}>\n <Text noMargin style={styles.handlingTagText}>\n {label}\n </Text>\n </View>\n ))}\n </View>\n )}\n\n <View style={styles.barcodeArea}>\n {data.barcodeUrl ? (\n <Image\n height={BARCODE_HEIGHT}\n src={data.barcodeUrl}\n width={BARCODE_WIDTH}\n />\n ) : (\n <PdfQRCode\n backgroundColor=\"#ffffff\"\n color=\"#000000\"\n size={80}\n value={data.trackingNumber}\n />\n )}\n <Text\n noMargin\n style={styles.trackingText}\n variant=\"xs\"\n weight=\"bold\"\n >\n {data.trackingNumber}\n </Text>\n </View>\n </View>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const ShippingLabelDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: ShippingLabelData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <ShippingLabelContent data={data} />\n </PdfcnThemeProvider>\n);\n",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { PdfQRCode } from \"@/components/pdf/qrcode/qrcode\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport { Image } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type {\n ShippingLabelAddress,\n ShippingLabelData,\n} from \"./shipping-label.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: ShippingLabelData = {\n carrier: \"UPS\",\n dimensions: '12\" x 8\" x 6\"',\n from: {\n address: \"456 Industrial Blvd\",\n city: \"Los Angeles\",\n country: \"USA\",\n name: \"ACME Corporation\",\n state: \"CA\",\n zip: \"90001\",\n },\n handlingLabels: [\"FRAGILE\", \"THIS SIDE UP\"],\n packageCount: 1,\n postage: \"$18.40\",\n serviceLevel: \"Ground\",\n to: {\n address: \"123 Main Street, Apt 4B\",\n city: \"New York\",\n country: \"USA\",\n name: \"John Doe\",\n phone: \"(503) 555-0142\",\n state: \"NY\",\n zip: \"10001\",\n },\n trackingNumber: \"TRACK123456789US\",\n weight: \"2.5 kg\",\n};\n\n// Standard 4\" x 6\" shipping label, expressed in PDF points (72 dpi)\nconst LABEL_SIZE = { height: 432, width: 288 };\n\n// Quiet zone kept clear of the printed label frame, plus the frame itself\nconst LABEL_MARGIN = 8;\nconst LABEL_BORDER = 2;\nconst LABEL_PADDING = 10;\n\n// Forme scales an image with the Image element's own width/height (style\n// dimensions only size the box), so the barcode is measured in points from\n// the label's content box instead of a percentage width.\nconst BARCODE_WIDTH =\n LABEL_SIZE.width - 2 * (LABEL_MARGIN + LABEL_BORDER + LABEL_PADDING);\nconst BARCODE_HEIGHT = 72;\n\nconst formatCityLine = (party: ShippingLabelAddress) => {\n const cityStateZip = `${party.city}, ${party.state} ${party.zip}`;\n return party.country ? `${cityStateZip}, ${party.country}` : cityStateZip;\n};\n\n// Shared address block — same treatment for both parties (10pt, bold name).\n// Forme's serializer drops components that return a Fragment, so the lines are\n// wrapped in a View; inside the column parent the stacking is identical.\nconst AddressLines = ({\n party,\n}: {\n party: ShippingLabelAddress & { phone?: string };\n}) => (\n <View>\n <Text noMargin variant=\"xs\" weight=\"bold\">\n {party.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {party.address}\n </Text>\n <Text noMargin variant=\"xs\">\n {formatCityLine(party)}\n </Text>\n {party.phone && (\n <Text noMargin variant=\"xs\" color=\"mutedForeground\">\n {party.phone}\n </Text>\n )}\n </View>\n);\n\nconst ShippingLabelContent = ({ data }: { data: ShippingLabelData }) => {\n const theme = usePdfcnTheme();\n\n const accent = resolveColor(\n data.accentColor ?? theme.colors.primary,\n theme.colors\n );\n\n const detailRows = [\n ...(data.weight ? [{ key: \"Weight\", value: data.weight }] : []),\n ...(data.dimensions ? [{ key: \"Dimensions\", value: data.dimensions }] : []),\n ...(typeof data.packageCount === \"number\"\n ? [{ key: \"Packages\", value: `${data.packageCount}` }]\n : []),\n { key: \"Postage\", value: data.postage ?? \"PAID\" },\n ];\n\n const styles = StyleSheet.create({\n addresses: { flex: 1, flexDirection: \"row\" },\n badgesRow: {\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 6,\n marginTop: 8,\n },\n barcodeArea: { alignItems: \"center\", marginTop: 10 },\n carrierName: { fontSize: 16, fontWeight: \"bold\" },\n fromColumn: { flex: 1, paddingLeft: 12 },\n handlingTag: {\n alignItems: \"center\",\n backgroundColor: theme.colors.foreground,\n justifyContent: \"center\",\n paddingHorizontal: 8,\n paddingVertical: 4,\n },\n handlingTagText: {\n color: theme.colors.background,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 1,\n textTransform: \"uppercase\",\n },\n headerRow: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n },\n label: {\n borderColor: theme.colors.foreground,\n borderWidth: LABEL_BORDER,\n flex: 1,\n padding: LABEL_PADDING,\n },\n page: {\n backgroundColor: theme.colors.background,\n flex: 1,\n flexDirection: \"column\",\n height: LABEL_SIZE.height - LABEL_MARGIN * 2,\n overflow: \"hidden\",\n },\n rule: {\n backgroundColor: theme.colors.foreground,\n height: 2,\n marginVertical: 6,\n },\n sectionLabel: {\n color: accent,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 1,\n marginBottom: 4,\n textTransform: \"uppercase\",\n },\n serviceRight: { alignItems: \"flex-end\" },\n shipToColumn: {\n borderRightColor: theme.colors.foreground,\n borderRightWidth: 2,\n flex: 1.4,\n paddingRight: 12,\n },\n table: {\n borderColor: theme.colors.foreground,\n borderWidth: 2,\n },\n tableKey: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.5,\n textTransform: \"uppercase\",\n width: 84,\n },\n tableRow: {\n alignItems: \"center\",\n borderBottomColor: theme.colors.border,\n borderBottomWidth: 1,\n flexDirection: \"row\",\n paddingHorizontal: 8,\n paddingVertical: 3,\n },\n tableRowLast: {\n alignItems: \"center\",\n flexDirection: \"row\",\n paddingHorizontal: 8,\n paddingVertical: 3,\n },\n tableValue: { flex: 1 },\n trackingText: {\n fontWeight: \"bold\",\n letterSpacing: 2,\n marginTop: 6,\n textTransform: \"uppercase\",\n },\n });\n\n return (\n <Document title={`Shipping Label ${data.trackingNumber}`}>\n <Page size={LABEL_SIZE} margin={LABEL_MARGIN}>\n <View style={styles.page as never}>\n <View style={styles.label}>\n <View style={styles.headerRow}>\n <Text noMargin style={styles.carrierName}>\n {data.carrier}\n </Text>\n <View style={styles.serviceRight}>\n <Text noMargin style={styles.sectionLabel}>\n {data.serviceLevel}\n </Text>\n </View>\n </View>\n\n <View style={styles.rule} />\n\n <View style={styles.addresses}>\n <View style={styles.shipToColumn}>\n <Text noMargin style={styles.sectionLabel}>\n Ship To\n </Text>\n <AddressLines party={data.to} />\n </View>\n <View style={styles.fromColumn}>\n <Text noMargin style={styles.sectionLabel}>\n From\n </Text>\n <AddressLines party={data.from} />\n </View>\n </View>\n\n <View style={styles.rule} />\n\n <View style={styles.table}>\n {detailRows.map((row, index) => (\n <View\n key={row.key}\n style={\n index === detailRows.length - 1\n ? styles.tableRowLast\n : styles.tableRow\n }\n >\n <Text noMargin style={styles.tableKey}>\n {row.key}\n </Text>\n <Text noMargin style={styles.tableValue} variant=\"xs\">\n {row.value}\n </Text>\n </View>\n ))}\n </View>\n\n {data.handlingLabels && data.handlingLabels.length > 0 && (\n <View style={styles.badgesRow}>\n {data.handlingLabels.map((label, index) => (\n <View key={`${label}-${index}`} style={styles.handlingTag}>\n <Text noMargin style={styles.handlingTagText}>\n {label}\n </Text>\n </View>\n ))}\n </View>\n )}\n\n <View style={styles.barcodeArea}>\n {data.barcodeUrl ? (\n <Image\n height={BARCODE_HEIGHT}\n src={data.barcodeUrl}\n width={BARCODE_WIDTH}\n />\n ) : (\n <PdfQRCode\n backgroundColor=\"#ffffff\"\n color=\"#000000\"\n size={80}\n value={data.trackingNumber}\n />\n )}\n <Text\n noMargin\n style={styles.trackingText}\n variant=\"xs\"\n weight=\"bold\"\n >\n {data.trackingNumber}\n </Text>\n </View>\n </View>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const ShippingLabelDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: ShippingLabelData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <ShippingLabelContent data={data} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/shipping-label/shipping-label.tsx"
},
@@ -28,4 +28,4 @@
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/signature.json b/apps/web/public/r/forme/signature.json
index 3541d15..4f61fe9 100644
--- a/apps/web/public/r/forme/signature.json
+++ b/apps/web/public/r/forme/signature.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/forme/components/signature/signature.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport {\r\n Text as PDFText,\r\n StyleSheet,\r\n View,\r\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type SignatureVariant = \"single\" | \"double\" | \"inline\";\r\n\r\n/**\r\n * Signature signer properties.\r\n * Props - `label` | `name` | `title` | `date`\r\n * @see {@link SignatureSigner}\r\n */\r\nexport interface SignatureSigner {\r\n label?: string;\r\n name?: string;\r\n title?: string;\r\n date?: string;\r\n}\r\n\r\n/**\r\n * Signature block properties.\r\n * Props - `variant` | `label` | `name` | `title` | `date` | `signers` | `style`\r\n * @see {@link PdfSignatureBlockProps}\r\n */\r\nexport interface PdfSignatureBlockProps {\r\n /**\r\n * Layout variant: [single, double, inline]\r\n * @default 'single'\r\n */\r\n variant?: SignatureVariant;\r\n label?: string;\r\n name?: string;\r\n title?: string;\r\n date?: string;\r\n signers?: [SignatureSigner, SignatureSigner];\r\n style?: Style;\r\n}\r\n\r\nconst createSignatureStyles = (t: PdfcnTheme) => {\r\n const { spacing, fontWeights, typography } = t.primitives;\r\n return StyleSheet.create({\r\n block: { flex: 1, minWidth: 140 },\r\n container: {\r\n marginBottom: t.spacing.componentGap,\r\n marginTop: t.spacing.sectionGap,\r\n },\r\n dateText: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.xs,\r\n marginTop: 1,\r\n },\r\n doubleRow: {\r\n flexDirection: \"row\",\r\n gap: spacing[8],\r\n justifyContent: \"space-between\",\r\n },\r\n inlineLabel: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.sm,\r\n },\r\n inlineLine: {\r\n borderBottomColor: t.colors.foreground,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: 1,\r\n height: spacing[5],\r\n minWidth: 120,\r\n paddingHorizontal: spacing[2],\r\n },\r\n inlineName: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n },\r\n inlineRow: {\r\n alignItems: \"center\",\r\n flexDirection: \"row\",\r\n flexWrap: \"wrap\",\r\n gap: spacing[3],\r\n },\r\n label: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.sm,\r\n marginBottom: spacing[1],\r\n },\r\n line: {\r\n borderBottomColor: t.colors.foreground,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: 1,\r\n marginBottom: spacing[1],\r\n minHeight: spacing[6],\r\n },\r\n name: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n fontWeight: fontWeights.semibold,\r\n },\r\n titleText: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.sm,\r\n },\r\n });\r\n};\r\n\r\nconst renderSignerBlock = (\r\n signer: SignatureSigner,\r\n styles: ReturnType<typeof createSignatureStyles>\r\n) => (\r\n <View style={styles.block}>\r\n {signer.label ? (\r\n <PDFText style={styles.label}>{signer.label}</PDFText>\r\n ) : null}\r\n <View style={styles.line} />\r\n {signer.name ? <PDFText style={styles.name}>{signer.name}</PDFText> : null}\r\n {signer.title ? (\r\n <PDFText style={styles.titleText}>{signer.title}</PDFText>\r\n ) : null}\r\n {signer.date ? (\r\n <PDFText style={styles.dateText}>{signer.date}</PDFText>\r\n ) : null}\r\n </View>\r\n);\r\n\r\nexport const PdfSignatureBlock = ({\r\n variant = \"single\",\r\n label = \"Signature\",\r\n name,\r\n title,\r\n date,\r\n signers,\r\n style,\r\n}: PdfSignatureBlockProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createSignatureStyles(theme), [theme]);\r\n const containerStyles: Style[] = [styles.container];\r\n if (style) {\r\n containerStyles.push(style);\r\n }\r\n\r\n if (variant === \"inline\") {\r\n return (\r\n <View wrap={false} style={containerStyles as never}>\r\n <View style={styles.inlineRow}>\r\n <PDFText style={styles.inlineLabel}>{`${label}:`}</PDFText>\r\n <View style={styles.inlineLine} />\r\n {name ? <PDFText style={styles.inlineName}>{name}</PDFText> : null}\r\n </View>\r\n </View>\r\n );\r\n }\r\n\r\n if (variant === \"double\") {\r\n const [first, second] = signers ?? [\r\n { date: \"\", label: \"Authorized by\", name: \"\", title: \"\" },\r\n { date: \"\", label: \"Approved by\", name: \"\", title: \"\" },\r\n ];\r\n return (\r\n <View wrap={false} style={containerStyles as never}>\r\n <View style={styles.doubleRow}>\r\n {renderSignerBlock(first, styles)}\r\n {renderSignerBlock(second, styles)}\r\n </View>\r\n </View>\r\n );\r\n }\r\n\r\n return (\r\n <View wrap={false} style={containerStyles as never}>\r\n {renderSignerBlock({ date, label, name, title }, styles)}\r\n </View>\r\n );\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type SignatureVariant = \"single\" | \"double\" | \"inline\";\n\n/**\n * Signature signer properties.\n * Props - `label` | `name` | `title` | `date`\n * @see {@link SignatureSigner}\n */\nexport interface SignatureSigner {\n label?: string;\n name?: string;\n title?: string;\n date?: string;\n}\n\n/**\n * Signature block properties.\n * Props - `variant` | `label` | `name` | `title` | `date` | `signers` | `style`\n * @see {@link PdfSignatureBlockProps}\n */\nexport interface PdfSignatureBlockProps {\n /**\n * Layout variant: [single, double, inline]\n * @default 'single'\n */\n variant?: SignatureVariant;\n label?: string;\n name?: string;\n title?: string;\n date?: string;\n signers?: [SignatureSigner, SignatureSigner];\n style?: Style;\n}\n\nconst createSignatureStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights, typography } = t.primitives;\n return StyleSheet.create({\n block: { flex: 1, minWidth: 140 },\n container: {\n marginBottom: t.spacing.componentGap,\n marginTop: t.spacing.sectionGap,\n },\n dateText: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n marginTop: 1,\n },\n doubleRow: {\n flexDirection: \"row\",\n gap: spacing[8],\n justifyContent: \"space-between\",\n },\n inlineLabel: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n },\n inlineLine: {\n borderBottomColor: t.colors.foreground,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n height: spacing[5],\n minWidth: 120,\n paddingHorizontal: spacing[2],\n },\n inlineName: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n },\n inlineRow: {\n alignItems: \"center\",\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: spacing[3],\n },\n label: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n marginBottom: spacing[1],\n },\n line: {\n borderBottomColor: t.colors.foreground,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n marginBottom: spacing[1],\n minHeight: spacing[6],\n },\n name: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n },\n titleText: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n },\n });\n};\n\nconst renderSignerBlock = (\n signer: SignatureSigner,\n styles: ReturnType<typeof createSignatureStyles>\n) => (\n <View style={styles.block}>\n {signer.label ? (\n <PDFText style={styles.label}>{signer.label}</PDFText>\n ) : null}\n <View style={styles.line} />\n {signer.name ? <PDFText style={styles.name}>{signer.name}</PDFText> : null}\n {signer.title ? (\n <PDFText style={styles.titleText}>{signer.title}</PDFText>\n ) : null}\n {signer.date ? (\n <PDFText style={styles.dateText}>{signer.date}</PDFText>\n ) : null}\n </View>\n);\n\nexport const PdfSignatureBlock = ({\n variant = \"single\",\n label = \"Signature\",\n name,\n title,\n date,\n signers,\n style,\n}: PdfSignatureBlockProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createSignatureStyles(theme), [theme]);\n const containerStyles: Style[] = [styles.container];\n if (style) {\n containerStyles.push(style);\n }\n\n if (variant === \"inline\") {\n return (\n <View wrap={false} style={containerStyles as never}>\n <View style={styles.inlineRow}>\n <PDFText style={styles.inlineLabel}>{`${label}:`}</PDFText>\n <View style={styles.inlineLine} />\n {name ? <PDFText style={styles.inlineName}>{name}</PDFText> : null}\n </View>\n </View>\n );\n }\n\n if (variant === \"double\") {\n const [first, second] = signers ?? [\n { date: \"\", label: \"Authorized by\", name: \"\", title: \"\" },\n { date: \"\", label: \"Approved by\", name: \"\", title: \"\" },\n ];\n return (\n <View wrap={false} style={containerStyles as never}>\n <View style={styles.doubleRow}>\n {renderSignerBlock(first, styles)}\n {renderSignerBlock(second, styles)}\n </View>\n </View>\n );\n }\n\n return (\n <View wrap={false} style={containerStyles as never}>\n {renderSignerBlock({ date, label, name, title }, styles)}\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/signature/signature.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/stack.json b/apps/web/public/r/forme/stack.json
index 2414c92..0aebe9d 100644
--- a/apps/web/public/r/forme/stack.json
+++ b/apps/web/public/r/forme/stack.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/forme/components/stack/stack.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport { StyleSheet, View } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type StackGap = \"none\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\r\nexport type StackDirection = \"vertical\" | \"horizontal\";\r\nexport type StackAlign = \"start\" | \"center\" | \"end\" | \"stretch\";\r\nexport type StackJustify = \"start\" | \"center\" | \"end\" | \"between\" | \"around\";\r\n\r\n/**\r\n * Flex layout container with gap and direction control.\r\n * Props - `gap` | `direction` | `align` | `justify` | `wrap` | `noWrap` | `children` | `style`\r\n * @see {@link StackProps}\r\n */\r\nexport interface StackProps extends PDFComponentProps {\r\n /**\r\n * @default 'md'\r\n */\r\n gap?: StackGap;\r\n /**\r\n * @default 'vertical'\r\n */\r\n direction?: StackDirection;\r\n /**\r\n * @default 'start'\r\n */\r\n align?: StackAlign;\r\n /**\r\n * @default 'start'\r\n */\r\n justify?: StackJustify;\r\n /**\r\n * @default false\r\n */\r\n wrap?: boolean;\r\n /**\r\n * @default false\r\n */\r\n noWrap?: boolean;\r\n}\r\n\r\nconst createStackStyles = (t: PdfcnTheme) => {\r\n const { spacing } = t.primitives;\r\n return StyleSheet.create({\r\n alignCenter: { alignItems: \"center\" },\r\n alignEnd: { alignItems: \"flex-end\" },\r\n alignStart: { alignItems: \"flex-start\" },\r\n alignStretch: { alignItems: \"stretch\" },\r\n gapLg: { gap: spacing[6] },\r\n gapMd: { gap: spacing[4] },\r\n gapNone: { gap: spacing[0] },\r\n gapSm: { gap: spacing[2] },\r\n gapXl: { gap: spacing[8] },\r\n horizontal: { flexDirection: \"row\" },\r\n justifyAround: { justifyContent: \"space-around\" },\r\n justifyBetween: { justifyContent: \"space-between\" },\r\n justifyCenter: { justifyContent: \"center\" },\r\n justifyEnd: { justifyContent: \"flex-end\" },\r\n justifyStart: { justifyContent: \"flex-start\" },\r\n vertical: { flexDirection: \"column\" },\r\n wrap: { flexWrap: \"wrap\" },\r\n });\r\n};\r\n\r\nexport const Stack = ({\r\n gap = \"md\",\r\n direction = \"vertical\",\r\n align,\r\n justify,\r\n wrap,\r\n noWrap,\r\n children,\r\n style,\r\n}: StackProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createStackStyles(theme), [theme]);\r\n const gapMap = {\r\n lg: styles.gapLg,\r\n md: styles.gapMd,\r\n none: styles.gapNone,\r\n sm: styles.gapSm,\r\n xl: styles.gapXl,\r\n };\r\n const alignMap = {\r\n center: styles.alignCenter,\r\n end: styles.alignEnd,\r\n start: styles.alignStart,\r\n stretch: styles.alignStretch,\r\n };\r\n const justifyMap = {\r\n around: styles.justifyAround,\r\n between: styles.justifyBetween,\r\n center: styles.justifyCenter,\r\n end: styles.justifyEnd,\r\n start: styles.justifyStart,\r\n };\r\n const styleArray: Style[] = [\r\n direction === \"horizontal\" ? styles.horizontal : styles.vertical,\r\n gapMap[gap],\r\n ];\r\n if (align && align in alignMap) {\r\n styleArray.push(alignMap[align]);\r\n }\r\n if (justify && justify in justifyMap) {\r\n styleArray.push(justifyMap[justify]);\r\n }\r\n if (wrap) {\r\n styleArray.push(styles.wrap);\r\n }\r\n if (style) {\r\n styleArray.push(...[style].flat());\r\n }\r\n return (\r\n <View wrap={noWrap ? false : undefined} style={styleArray as never}>\r\n {children}\r\n </View>\r\n );\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport { StyleSheet, View } from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type StackGap = \"none\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type StackDirection = \"vertical\" | \"horizontal\";\nexport type StackAlign = \"start\" | \"center\" | \"end\" | \"stretch\";\nexport type StackJustify = \"start\" | \"center\" | \"end\" | \"between\" | \"around\";\n\n/**\n * Flex layout container with gap and direction control.\n * Props - `gap` | `direction` | `align` | `justify` | `wrap` | `noWrap` | `children` | `style`\n * @see {@link StackProps}\n */\nexport interface StackProps extends PDFComponentProps {\n /**\n * @default 'md'\n */\n gap?: StackGap;\n /**\n * @default 'vertical'\n */\n direction?: StackDirection;\n /**\n * @default 'start'\n */\n align?: StackAlign;\n /**\n * @default 'start'\n */\n justify?: StackJustify;\n /**\n * @default false\n */\n wrap?: boolean;\n /**\n * @default false\n */\n noWrap?: boolean;\n}\n\nconst createStackStyles = (t: PdfcnTheme) => {\n const { spacing } = t.primitives;\n return StyleSheet.create({\n alignCenter: { alignItems: \"center\" },\n alignEnd: { alignItems: \"flex-end\" },\n alignStart: { alignItems: \"flex-start\" },\n alignStretch: { alignItems: \"stretch\" },\n gapLg: { gap: spacing[6] },\n gapMd: { gap: spacing[4] },\n gapNone: { gap: spacing[0] },\n gapSm: { gap: spacing[2] },\n gapXl: { gap: spacing[8] },\n horizontal: { flexDirection: \"row\" },\n justifyAround: { justifyContent: \"space-around\" },\n justifyBetween: { justifyContent: \"space-between\" },\n justifyCenter: { justifyContent: \"center\" },\n justifyEnd: { justifyContent: \"flex-end\" },\n justifyStart: { justifyContent: \"flex-start\" },\n vertical: { flexDirection: \"column\" },\n wrap: { flexWrap: \"wrap\" },\n });\n};\n\nexport const Stack = ({\n gap = \"md\",\n direction = \"vertical\",\n align,\n justify,\n wrap,\n noWrap,\n children,\n style,\n}: StackProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createStackStyles(theme), [theme]);\n const gapMap = {\n lg: styles.gapLg,\n md: styles.gapMd,\n none: styles.gapNone,\n sm: styles.gapSm,\n xl: styles.gapXl,\n };\n const alignMap = {\n center: styles.alignCenter,\n end: styles.alignEnd,\n start: styles.alignStart,\n stretch: styles.alignStretch,\n };\n const justifyMap = {\n around: styles.justifyAround,\n between: styles.justifyBetween,\n center: styles.justifyCenter,\n end: styles.justifyEnd,\n start: styles.justifyStart,\n };\n const styleArray: Style[] = [\n direction === \"horizontal\" ? styles.horizontal : styles.vertical,\n gapMap[gap],\n ];\n if (align && align in alignMap) {\n styleArray.push(alignMap[align]);\n }\n if (justify && justify in justifyMap) {\n styleArray.push(justifyMap[justify]);\n }\n if (wrap) {\n styleArray.push(styles.wrap);\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return (\n <View wrap={noWrap ? false : undefined} style={styleArray as never}>\n {children}\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/stack/stack.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/table.json b/apps/web/public/r/forme/table.json
index 1ea25b8..b1a6a30 100644
--- a/apps/web/public/r/forme/table.json
+++ b/apps/web/public/r/forme/table.json
@@ -13,22 +13,22 @@
"files": [
{
"path": "registry/bases/forme/components/table/table.styles.ts",
- "content": "import { StyleSheet } from \"@formepdf/react\";\r\n\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\n/**\r\n * Creates all table styles derived from the active theme.\r\n * @param t - The resolved PdfcnTheme instance.\r\n */\r\nexport const createTableStyles = (t: PdfcnTheme) => {\r\n const { spacing, borderRadius, fontWeights, typography } = t.primitives;\r\n const borderColor = t.colors.border;\r\n\r\n const hairline = 0.5;\r\n const rule = 1;\r\n const thick = 1.5;\r\n\r\n const cellPadV = spacing[2] - 2;\r\n const cellPadH = spacing[2] + 2;\r\n // eslint-disable-next-line prefer-destructuring\r\n const cellPadVCompact = spacing[0.5];\r\n // eslint-disable-next-line prefer-destructuring\r\n const cellPadHCompact = spacing[2];\r\n\r\n const rowDivider = {\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\" as const,\r\n borderBottomWidth: hairline,\r\n };\r\n\r\n return StyleSheet.create({\r\n cell: {\r\n flex: 1,\r\n justifyContent: \"center\",\r\n paddingHorizontal: cellPadH,\r\n paddingVertical: cellPadV,\r\n },\r\n\r\n cellBordered: {\r\n paddingHorizontal: cellPadH,\r\n paddingVertical: cellPadV,\r\n },\r\n\r\n cellBorderedBorder: {\r\n borderRightColor: borderColor,\r\n borderRightStyle: \"solid\",\r\n borderRightWidth: hairline,\r\n },\r\n\r\n cellCompact: {\r\n paddingHorizontal: cellPadHCompact,\r\n paddingVertical: cellPadVCompact,\r\n },\r\n\r\n cellFixed: {\r\n flexGrow: 0,\r\n flexShrink: 0,\r\n justifyContent: \"center\",\r\n paddingHorizontal: cellPadH,\r\n paddingVertical: cellPadV,\r\n },\r\n\r\n cellGridBorder: {\r\n borderRightColor: borderColor,\r\n borderRightStyle: \"solid\",\r\n borderRightWidth: hairline,\r\n },\r\n\r\n cellMinimal: {\r\n paddingHorizontal: spacing[2] - 2,\r\n paddingVertical: spacing[1] + 1,\r\n },\r\n\r\n cellPrimaryHeader: {\r\n paddingHorizontal: cellPadH,\r\n paddingVertical: cellPadV,\r\n },\r\n\r\n cellStriped: {\r\n paddingHorizontal: cellPadH,\r\n paddingVertical: cellPadV,\r\n },\r\n\r\n cellText: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n lineHeight: 1.2,\r\n },\r\n cellTextCompact: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.xs,\r\n lineHeight: 1.2,\r\n },\r\n cellTextFooter: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n fontWeight: fontWeights.semibold,\r\n lineHeight: 1.2,\r\n },\r\n cellTextHeaderBordered: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n fontWeight: fontWeights.bold,\r\n lineHeight: 1.2,\r\n },\r\n cellTextHeaderCompact: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.xs,\r\n fontWeight: fontWeights.semibold,\r\n letterSpacing: 0.6,\r\n lineHeight: 1.2,\r\n textTransform: \"uppercase\",\r\n },\r\n cellTextHeaderGrid: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n fontWeight: fontWeights.semibold,\r\n lineHeight: 1.2,\r\n },\r\n cellTextHeaderLine: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n fontWeight: fontWeights.semibold,\r\n lineHeight: 1.2,\r\n },\r\n\r\n cellTextHeaderMinimal: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n fontWeight: fontWeights.medium,\r\n lineHeight: 1.2,\r\n },\r\n cellTextHeaderPrimaryHeader: {\r\n color: t.colors.primaryForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.xs,\r\n fontWeight: fontWeights.semibold,\r\n letterSpacing: 0.6,\r\n lineHeight: 1.2,\r\n textTransform: \"uppercase\",\r\n },\r\n cellTextHeaderStriped: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n fontWeight: fontWeights.semibold,\r\n lineHeight: 1.2,\r\n },\r\n row: {\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n },\r\n rowBordered: rowDivider,\r\n rowCompact: rowDivider,\r\n rowFooter: {\r\n borderTopColor: borderColor,\r\n borderTopStyle: \"solid\",\r\n borderTopWidth: rule,\r\n },\r\n\r\n rowFooterStriped: {\r\n backgroundColor: t.colors.muted,\r\n borderTopColor: borderColor,\r\n borderTopStyle: \"solid\",\r\n borderTopWidth: rule,\r\n },\r\n rowGrid: rowDivider,\r\n\r\n rowHeaderBordered: {\r\n backgroundColor: t.colors.muted,\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: hairline,\r\n },\r\n\r\n rowHeaderCompact: {\r\n backgroundColor: t.colors.muted,\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: rule,\r\n },\r\n rowHeaderGrid: {\r\n backgroundColor: t.colors.muted,\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: rule,\r\n },\r\n\r\n rowHeaderLine: {\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: rule,\r\n },\r\n rowHeaderMinimal: {\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: rule,\r\n },\r\n rowHeaderPrimaryHeader: {\r\n backgroundColor: t.colors.primary,\r\n },\r\n rowHeaderStriped: {\r\n backgroundColor: t.colors.muted,\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: rule,\r\n },\r\n rowLine: rowDivider,\r\n\r\n rowMinimal: rowDivider,\r\n rowPrimaryHeader: rowDivider,\r\n\r\n rowStripe: {\r\n backgroundColor: t.colors.muted,\r\n },\r\n\r\n rowStriped: {},\r\n table: {\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n marginBottom: t.spacing.componentGap,\r\n width: \"100%\",\r\n },\r\n tableBordered: {\r\n borderBottomLeftRadius: borderRadius.sm,\r\n borderBottomRightRadius: borderRadius.sm,\r\n borderColor,\r\n borderStyle: \"solid\",\r\n borderTopLeftRadius: borderRadius.sm,\r\n borderTopRightRadius: borderRadius.sm,\r\n borderWidth: rule,\r\n overflow: \"hidden\" as const,\r\n },\r\n tableCompact: {\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: hairline,\r\n },\r\n tableGrid: {\r\n borderBottomLeftRadius: borderRadius.md,\r\n borderBottomRightRadius: borderRadius.md,\r\n borderColor,\r\n borderStyle: \"solid\",\r\n borderTopLeftRadius: borderRadius.md,\r\n borderTopRightRadius: borderRadius.md,\r\n borderWidth: thick,\r\n overflow: \"hidden\" as const,\r\n },\r\n tableLine: {\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: hairline,\r\n },\r\n tableMinimal: {\r\n paddingVertical: spacing[2],\r\n },\r\n\r\n tablePrimaryHeader: {\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: hairline,\r\n },\r\n\r\n tableStriped: {\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: hairline,\r\n borderTopColor: borderColor,\r\n borderTopStyle: \"solid\",\r\n borderTopWidth: hairline,\r\n },\r\n });\r\n};\r\n",
+ "content": "import { StyleSheet } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\n/**\n * Creates all table styles derived from the active theme.\n * @param t - The resolved PdfcnTheme instance.\n */\nexport const createTableStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius, fontWeights, typography } = t.primitives;\n const borderColor = t.colors.border;\n\n const hairline = 0.5;\n const rule = 1;\n const thick = 1.5;\n\n const cellPadV = spacing[2] - 2;\n const cellPadH = spacing[2] + 2;\n // eslint-disable-next-line prefer-destructuring\n const cellPadVCompact = spacing[0.5];\n // eslint-disable-next-line prefer-destructuring\n const cellPadHCompact = spacing[2];\n\n const rowDivider = {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\" as const,\n borderBottomWidth: hairline,\n };\n\n return StyleSheet.create({\n cell: {\n flex: 1,\n justifyContent: \"center\",\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellBordered: {\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellBorderedBorder: {\n borderRightColor: borderColor,\n borderRightStyle: \"solid\",\n borderRightWidth: hairline,\n },\n\n cellCompact: {\n paddingHorizontal: cellPadHCompact,\n paddingVertical: cellPadVCompact,\n },\n\n cellFixed: {\n flexGrow: 0,\n flexShrink: 0,\n justifyContent: \"center\",\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellGridBorder: {\n borderRightColor: borderColor,\n borderRightStyle: \"solid\",\n borderRightWidth: hairline,\n },\n\n cellMinimal: {\n paddingHorizontal: spacing[2] - 2,\n paddingVertical: spacing[1] + 1,\n },\n\n cellPrimaryHeader: {\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellStriped: {\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellText: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n lineHeight: 1.2,\n },\n cellTextCompact: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n lineHeight: 1.2,\n },\n cellTextFooter: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n cellTextHeaderBordered: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.bold,\n lineHeight: 1.2,\n },\n cellTextHeaderCompact: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.6,\n lineHeight: 1.2,\n textTransform: \"uppercase\",\n },\n cellTextHeaderGrid: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n cellTextHeaderLine: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n\n cellTextHeaderMinimal: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.medium,\n lineHeight: 1.2,\n },\n cellTextHeaderPrimaryHeader: {\n color: t.colors.primaryForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.6,\n lineHeight: 1.2,\n textTransform: \"uppercase\",\n },\n cellTextHeaderStriped: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n row: {\n display: \"flex\",\n flexDirection: \"row\",\n },\n rowBordered: rowDivider,\n rowCompact: rowDivider,\n rowFooter: {\n borderTopColor: borderColor,\n borderTopStyle: \"solid\",\n borderTopWidth: rule,\n },\n\n rowFooterStriped: {\n backgroundColor: t.colors.muted,\n borderTopColor: borderColor,\n borderTopStyle: \"solid\",\n borderTopWidth: rule,\n },\n rowGrid: rowDivider,\n\n rowHeaderBordered: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n\n rowHeaderCompact: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowHeaderGrid: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n\n rowHeaderLine: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowHeaderMinimal: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowHeaderPrimaryHeader: {\n backgroundColor: t.colors.primary,\n },\n rowHeaderStriped: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowLine: rowDivider,\n\n rowMinimal: rowDivider,\n rowPrimaryHeader: rowDivider,\n\n rowStripe: {\n backgroundColor: t.colors.muted,\n },\n\n rowStriped: {},\n table: {\n display: \"flex\",\n flexDirection: \"column\",\n marginBottom: t.spacing.componentGap,\n width: \"100%\",\n },\n tableBordered: {\n borderBottomLeftRadius: borderRadius.sm,\n borderBottomRightRadius: borderRadius.sm,\n borderColor,\n borderStyle: \"solid\",\n borderTopLeftRadius: borderRadius.sm,\n borderTopRightRadius: borderRadius.sm,\n borderWidth: rule,\n overflow: \"hidden\" as const,\n },\n tableCompact: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n tableGrid: {\n borderBottomLeftRadius: borderRadius.md,\n borderBottomRightRadius: borderRadius.md,\n borderColor,\n borderStyle: \"solid\",\n borderTopLeftRadius: borderRadius.md,\n borderTopRightRadius: borderRadius.md,\n borderWidth: thick,\n overflow: \"hidden\" as const,\n },\n tableLine: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n tableMinimal: {\n paddingVertical: spacing[2],\n },\n\n tablePrimaryHeader: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n\n tableStriped: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n borderTopColor: borderColor,\n borderTopStyle: \"solid\",\n borderTopWidth: hairline,\n },\n });\n};\n",
"type": "registry:component",
"target": "components/pdf/table/table.styles.ts"
},
{
"path": "registry/bases/forme/components/table/table.tsx",
- "content": "import { Children, cloneElement, isValidElement } from \"react\";\r\nimport type { ReactElement, ReactNode } from \"react\";\r\n\r\nimport {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport {\r\n Text as PDFText,\r\n View,\r\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\n\r\nimport { createTableStyles } from \"./table.styles\";\r\nimport type {\r\n TableCellProps,\r\n TableProps,\r\n TableRowProps,\r\n TableSectionProps,\r\n TableVariant,\r\n} from \"./table.types\";\r\n\r\nexport const TableHeader = ({ children, style }: TableSectionProps) => (\r\n <View style={style}>{children}</View>\r\n);\r\n\r\nexport const TableBody = ({ children, style }: TableSectionProps) => (\r\n <View style={style}>{children}</View>\r\n);\r\n\r\nexport const TableFooter = ({ children, style }: TableSectionProps) => (\r\n <View style={style}>{children}</View>\r\n);\r\n\r\nexport const TableCell = ({\r\n header,\r\n footer,\r\n align,\r\n width,\r\n children,\r\n style,\r\n variant = \"line\",\r\n _last,\r\n}: TableCellProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createTableStyles(theme), [theme]);\r\n const cellStyles: Style[] =\r\n width === undefined\r\n ? [styles.cell]\r\n : [styles.cellFixed, { width } as Style];\r\n\r\n const cellVariantStyle = (\r\n {\r\n bordered: styles.cellBordered,\r\n compact: styles.cellCompact,\r\n minimal: styles.cellMinimal,\r\n \"primary-header\": styles.cellPrimaryHeader,\r\n striped: styles.cellStriped,\r\n } as Partial<Record<TableVariant, Style>>\r\n )[variant];\r\n if (cellVariantStyle) {\r\n cellStyles.push(cellVariantStyle);\r\n }\r\n\r\n if (variant === \"grid\" && !_last) {\r\n cellStyles.push(styles.cellGridBorder);\r\n } else if (variant === \"bordered\" && !_last) {\r\n cellStyles.push(styles.cellBorderedBorder);\r\n }\r\n\r\n if (align) {\r\n cellStyles.push({ textAlign: align } as Style);\r\n }\r\n\r\n const styleArray = style ? [...cellStyles, style] : cellStyles;\r\n\r\n let textStyle: Style = styles.cellText;\r\n if (header) {\r\n textStyle = {\r\n bordered: styles.cellTextHeaderBordered,\r\n compact: styles.cellTextHeaderCompact,\r\n grid: styles.cellTextHeaderGrid,\r\n line: styles.cellTextHeaderLine,\r\n minimal: styles.cellTextHeaderMinimal,\r\n \"primary-header\": styles.cellTextHeaderPrimaryHeader,\r\n striped: styles.cellTextHeaderStriped,\r\n }[variant];\r\n } else if (footer) {\r\n textStyle = styles.cellTextFooter;\r\n } else if (variant === \"compact\") {\r\n textStyle = styles.cellTextCompact;\r\n }\r\n\r\n const content =\r\n typeof children === \"string\" ? (\r\n <PDFText\r\n style={\r\n [\r\n textStyle,\r\n align ? { textAlign: align } : {},\r\n { margin: 0, padding: 0 },\r\n ] as never\r\n }\r\n >\r\n {children}\r\n </PDFText>\r\n ) : (\r\n children\r\n );\r\n\r\n return <View style={styleArray as never}>{content}</View>;\r\n};\r\n\r\nexport const TableRow = ({\r\n header,\r\n footer,\r\n stripe,\r\n children,\r\n style,\r\n variant = \"line\",\r\n}: TableRowProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createTableStyles(theme), [theme]);\r\n const rowStyles: Style[] = [\r\n styles.row,\r\n {\r\n bordered: styles.rowBordered,\r\n compact: styles.rowCompact,\r\n grid: styles.rowGrid,\r\n line: styles.rowLine,\r\n minimal: styles.rowMinimal,\r\n \"primary-header\": styles.rowPrimaryHeader,\r\n striped: styles.rowStriped,\r\n }[variant],\r\n ];\r\n\r\n if (header) {\r\n rowStyles.push(\r\n {\r\n bordered: styles.rowHeaderBordered,\r\n compact: styles.rowHeaderCompact,\r\n grid: styles.rowHeaderGrid,\r\n line: styles.rowHeaderLine,\r\n minimal: styles.rowHeaderMinimal,\r\n \"primary-header\": styles.rowHeaderPrimaryHeader,\r\n striped: styles.rowHeaderStriped,\r\n }[variant]\r\n );\r\n }\r\n\r\n if (footer) {\r\n if (variant === \"striped\") {\r\n rowStyles.push(styles.rowFooterStriped);\r\n } else {\r\n rowStyles.push(styles.rowFooter);\r\n }\r\n }\r\n\r\n if (stripe && !header && !footer) {\r\n rowStyles.push(styles.rowStripe);\r\n }\r\n\r\n const styleArray = style ? [...rowStyles, style] : rowStyles;\r\n const childArray = Children.toArray(children);\r\n const processedChildren = childArray.map((child, i) => {\r\n if (isValidElement(child) && child.type === TableCell) {\r\n return cloneElement(child as ReactElement<TableCellProps>, {\r\n _last: i === childArray.length - 1,\r\n footer,\r\n header,\r\n variant,\r\n });\r\n }\r\n return child;\r\n });\r\n\r\n return (\r\n <View wrap={false} style={styleArray as never}>\r\n {processedChildren}\r\n </View>\r\n );\r\n};\r\n\r\nconst processTableChildren = (\r\n children: ReactNode,\r\n variant: TableVariant,\r\n zebraStripe: boolean\r\n): ReactNode => {\r\n let bodyRowIndex = 0;\r\n\r\n return Children.map(children, (child) => {\r\n if (!isValidElement(child)) {\r\n return child;\r\n }\r\n\r\n if (\r\n child.type === TableHeader ||\r\n child.type === TableBody ||\r\n child.type === TableFooter\r\n ) {\r\n const isBody = child.type === TableBody;\r\n const sectionChild = child as ReactElement<TableSectionProps>;\r\n const sectionChildren = Children.map(\r\n sectionChild.props.children,\r\n (rowChild) => {\r\n if (isValidElement(rowChild) && rowChild.type === TableRow) {\r\n const rowProps: Partial<TableRowProps> = { variant };\r\n\r\n if (isBody && zebraStripe) {\r\n const isStripe = bodyRowIndex % 2 === 1;\r\n bodyRowIndex += 1;\r\n if (isStripe) {\r\n rowProps.stripe = true;\r\n }\r\n }\r\n\r\n return cloneElement(\r\n rowChild as ReactElement<TableRowProps>,\r\n rowProps\r\n );\r\n }\r\n return rowChild;\r\n }\r\n );\r\n\r\n return cloneElement(child, {}, sectionChildren);\r\n }\r\n\r\n if (child.type === TableRow) {\r\n return cloneElement(child as ReactElement<TableRowProps>, { variant });\r\n }\r\n\r\n return child;\r\n });\r\n};\r\n\r\nexport const Table = ({\r\n children,\r\n style,\r\n variant = \"line\",\r\n zebraStripe = false,\r\n noWrap = false,\r\n}: TableProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createTableStyles(theme), [theme]);\r\n const tableStyles: Style[] = [styles.table];\r\n const effectiveZebra = variant === \"striped\" ? true : zebraStripe;\r\n\r\n tableStyles.push(\r\n {\r\n bordered: styles.tableBordered,\r\n compact: styles.tableCompact,\r\n grid: styles.tableGrid,\r\n line: styles.tableLine,\r\n minimal: styles.tableMinimal,\r\n \"primary-header\": styles.tablePrimaryHeader,\r\n striped: styles.tableStriped,\r\n }[variant]\r\n );\r\n\r\n const styleArray = style ? [...tableStyles, style] : tableStyles;\r\n const processedChildren = processTableChildren(\r\n children,\r\n variant,\r\n effectiveZebra\r\n );\r\n\r\n const inner = <View style={styleArray as never}>{processedChildren}</View>;\r\n return noWrap ? <View wrap={false}>{inner}</View> : inner;\r\n};\r\n",
+ "content": "import { Children, cloneElement, isValidElement } from \"react\";\nimport type { ReactElement, ReactNode } from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Text as PDFText,\n View,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\n\nimport { createTableStyles } from \"./table.styles\";\nimport type {\n TableCellProps,\n TableProps,\n TableRowProps,\n TableSectionProps,\n TableVariant,\n} from \"./table.types\";\n\nexport const TableHeader = ({ children, style }: TableSectionProps) => (\n <View style={style}>{children}</View>\n);\n\nexport const TableBody = ({ children, style }: TableSectionProps) => (\n <View style={style}>{children}</View>\n);\n\nexport const TableFooter = ({ children, style }: TableSectionProps) => (\n <View style={style}>{children}</View>\n);\n\nexport const TableCell = ({\n header,\n footer,\n align,\n width,\n children,\n style,\n variant = \"line\",\n _last,\n}: TableCellProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createTableStyles(theme), [theme]);\n const cellStyles: Style[] =\n width === undefined\n ? [styles.cell]\n : [styles.cellFixed, { width } as Style];\n\n const cellVariantStyle = (\n {\n bordered: styles.cellBordered,\n compact: styles.cellCompact,\n minimal: styles.cellMinimal,\n \"primary-header\": styles.cellPrimaryHeader,\n striped: styles.cellStriped,\n } as Partial<Record<TableVariant, Style>>\n )[variant];\n if (cellVariantStyle) {\n cellStyles.push(cellVariantStyle);\n }\n\n if (variant === \"grid\" && !_last) {\n cellStyles.push(styles.cellGridBorder);\n } else if (variant === \"bordered\" && !_last) {\n cellStyles.push(styles.cellBorderedBorder);\n }\n\n if (align) {\n cellStyles.push({ textAlign: align } as Style);\n }\n\n const styleArray = style ? [...cellStyles, style] : cellStyles;\n\n let textStyle: Style = styles.cellText;\n if (header) {\n textStyle = {\n bordered: styles.cellTextHeaderBordered,\n compact: styles.cellTextHeaderCompact,\n grid: styles.cellTextHeaderGrid,\n line: styles.cellTextHeaderLine,\n minimal: styles.cellTextHeaderMinimal,\n \"primary-header\": styles.cellTextHeaderPrimaryHeader,\n striped: styles.cellTextHeaderStriped,\n }[variant];\n } else if (footer) {\n textStyle = styles.cellTextFooter;\n } else if (variant === \"compact\") {\n textStyle = styles.cellTextCompact;\n }\n\n const content =\n typeof children === \"string\" ? (\n <PDFText\n style={\n [\n textStyle,\n align ? { textAlign: align } : {},\n { margin: 0, padding: 0 },\n ] as never\n }\n >\n {children}\n </PDFText>\n ) : (\n children\n );\n\n return <View style={styleArray as never}>{content}</View>;\n};\n\nexport const TableRow = ({\n header,\n footer,\n stripe,\n children,\n style,\n variant = \"line\",\n}: TableRowProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createTableStyles(theme), [theme]);\n const rowStyles: Style[] = [\n styles.row,\n {\n bordered: styles.rowBordered,\n compact: styles.rowCompact,\n grid: styles.rowGrid,\n line: styles.rowLine,\n minimal: styles.rowMinimal,\n \"primary-header\": styles.rowPrimaryHeader,\n striped: styles.rowStriped,\n }[variant],\n ];\n\n if (header) {\n rowStyles.push(\n {\n bordered: styles.rowHeaderBordered,\n compact: styles.rowHeaderCompact,\n grid: styles.rowHeaderGrid,\n line: styles.rowHeaderLine,\n minimal: styles.rowHeaderMinimal,\n \"primary-header\": styles.rowHeaderPrimaryHeader,\n striped: styles.rowHeaderStriped,\n }[variant]\n );\n }\n\n if (footer) {\n if (variant === \"striped\") {\n rowStyles.push(styles.rowFooterStriped);\n } else {\n rowStyles.push(styles.rowFooter);\n }\n }\n\n if (stripe && !header && !footer) {\n rowStyles.push(styles.rowStripe);\n }\n\n const styleArray = style ? [...rowStyles, style] : rowStyles;\n const childArray = Children.toArray(children);\n const processedChildren = childArray.map((child, i) => {\n if (isValidElement(child) && child.type === TableCell) {\n return cloneElement(child as ReactElement<TableCellProps>, {\n _last: i === childArray.length - 1,\n footer,\n header,\n variant,\n });\n }\n return child;\n });\n\n return (\n <View wrap={false} style={styleArray as never}>\n {processedChildren}\n </View>\n );\n};\n\nconst processTableChildren = (\n children: ReactNode,\n variant: TableVariant,\n zebraStripe: boolean\n): ReactNode => {\n let bodyRowIndex = 0;\n\n return Children.map(children, (child) => {\n if (!isValidElement(child)) {\n return child;\n }\n\n if (\n child.type === TableHeader ||\n child.type === TableBody ||\n child.type === TableFooter\n ) {\n const isBody = child.type === TableBody;\n const sectionChild = child as ReactElement<TableSectionProps>;\n const sectionChildren = Children.map(\n sectionChild.props.children,\n (rowChild) => {\n if (isValidElement(rowChild) && rowChild.type === TableRow) {\n const rowProps: Partial<TableRowProps> = { variant };\n\n if (isBody && zebraStripe) {\n const isStripe = bodyRowIndex % 2 === 1;\n bodyRowIndex += 1;\n if (isStripe) {\n rowProps.stripe = true;\n }\n }\n\n return cloneElement(\n rowChild as ReactElement<TableRowProps>,\n rowProps\n );\n }\n return rowChild;\n }\n );\n\n return cloneElement(child, {}, sectionChildren);\n }\n\n if (child.type === TableRow) {\n return cloneElement(child as ReactElement<TableRowProps>, { variant });\n }\n\n return child;\n });\n};\n\nexport const Table = ({\n children,\n style,\n variant = \"line\",\n zebraStripe = false,\n noWrap = false,\n}: TableProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createTableStyles(theme), [theme]);\n const tableStyles: Style[] = [styles.table];\n const effectiveZebra = variant === \"striped\" ? true : zebraStripe;\n\n tableStyles.push(\n {\n bordered: styles.tableBordered,\n compact: styles.tableCompact,\n grid: styles.tableGrid,\n line: styles.tableLine,\n minimal: styles.tableMinimal,\n \"primary-header\": styles.tablePrimaryHeader,\n striped: styles.tableStriped,\n }[variant]\n );\n\n const styleArray = style ? [...tableStyles, style] : tableStyles;\n const processedChildren = processTableChildren(\n children,\n variant,\n effectiveZebra\n );\n\n const inner = <View style={styleArray as never}>{processedChildren}</View>;\n return noWrap ? <View wrap={false}>{inner}</View> : inner;\n};\n",
"type": "registry:component",
"target": "components/pdf/table/table.tsx"
},
{
"path": "registry/bases/forme/components/table/table.types.ts",
- "content": "import type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\n\r\n/** Table visual style variant. */\r\nexport type TableVariant =\r\n | \"line\"\r\n | \"grid\"\r\n | \"minimal\"\r\n | \"striped\"\r\n | \"compact\"\r\n | \"bordered\"\r\n | \"primary-header\";\r\n\r\n/**\r\n * Table container with visual style variants and optional zebra striping.\r\n * Props - `variant` | `zebraStripe` | `noWrap` | `children` | `style`\r\n * @see {@link TableProps}\r\n */\r\nexport interface TableProps extends PDFComponentProps {\r\n /**\r\n * @default 'line'\r\n */\r\n variant?: TableVariant;\r\n /**\r\n * @default false\r\n */\r\n zebraStripe?: boolean;\r\n /**\r\n * @default false\r\n */\r\n noWrap?: boolean;\r\n}\r\n\r\nexport type TableSectionProps = PDFComponentProps;\r\n\r\n/**\r\n * Table row with optional header, footer, and stripe states.\r\n * Props - `header` | `footer` | `stripe` | `variant` | `children` | `style`\r\n * @see {@link TableRowProps}\r\n */\r\nexport interface TableRowProps extends PDFComponentProps {\r\n header?: boolean;\r\n footer?: boolean;\r\n stripe?: boolean;\r\n variant?: TableVariant;\r\n}\r\n\r\n/**\r\n * Table cell with alignment, width, and header or footer text styling.\r\n * Props - `header` | `footer` | `align` | `width` | `variant` | `_last` | `children` | `style`\r\n * @see {@link TableCellProps}\r\n */\r\nexport interface TableCellProps extends PDFComponentProps {\r\n header?: boolean;\r\n footer?: boolean;\r\n align?: \"left\" | \"center\" | \"right\";\r\n width?: string | number;\r\n variant?: TableVariant;\r\n _last?: boolean;\r\n}\r\n",
+ "content": "import type { PDFComponentProps } from \"@/types/pdf-components\";\n\n/** Table visual style variant. */\nexport type TableVariant =\n | \"line\"\n | \"grid\"\n | \"minimal\"\n | \"striped\"\n | \"compact\"\n | \"bordered\"\n | \"primary-header\";\n\n/**\n * Table container with visual style variants and optional zebra striping.\n * Props - `variant` | `zebraStripe` | `noWrap` | `children` | `style`\n * @see {@link TableProps}\n */\nexport interface TableProps extends PDFComponentProps {\n /**\n * @default 'line'\n */\n variant?: TableVariant;\n /**\n * @default false\n */\n zebraStripe?: boolean;\n /**\n * @default false\n */\n noWrap?: boolean;\n}\n\nexport type TableSectionProps = PDFComponentProps;\n\n/**\n * Table row with optional header, footer, and stripe states.\n * Props - `header` | `footer` | `stripe` | `variant` | `children` | `style`\n * @see {@link TableRowProps}\n */\nexport interface TableRowProps extends PDFComponentProps {\n header?: boolean;\n footer?: boolean;\n stripe?: boolean;\n variant?: TableVariant;\n}\n\n/**\n * Table cell with alignment, width, and header or footer text styling.\n * Props - `header` | `footer` | `align` | `width` | `variant` | `_last` | `children` | `style`\n * @see {@link TableCellProps}\n */\nexport interface TableCellProps extends PDFComponentProps {\n header?: boolean;\n footer?: boolean;\n align?: \"left\" | \"center\" | \"right\";\n width?: string | number;\n variant?: TableVariant;\n _last?: boolean;\n}\n",
"type": "registry:component",
"target": "components/pdf/table/table.types.ts"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/text.json b/apps/web/public/r/forme/text.json
index 997e9b9..2885bfa 100644
--- a/apps/web/public/r/forme/text.json
+++ b/apps/web/public/r/forme/text.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/forme/components/text/text.tsx",
- "content": "import {\r\n mergePdfStyles,\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/forme/components/theme-provider\";\r\nimport {\r\n Text as PDFText,\r\n StyleSheet,\r\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type TextVariant = \"xs\" | \"sm\" | \"base\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\";\r\nexport type TextWeight = \"normal\" | \"medium\" | \"semibold\" | \"bold\";\r\nexport type TextDecoration = \"underline\" | \"line-through\" | \"none\";\r\n\r\n/**\r\n * Body text with typography scale, alignment, and decoration options.\r\n * Props - `variant` | `align` | `color` | `weight` | `italic` | `decoration` | `transform` | `noMargin` | `children` | `style`\r\n * @see {@link TextProps}\r\n */\r\nexport interface TextProps extends PDFComponentProps {\r\n /**\r\n * @default 'base'\r\n */\r\n variant?: TextVariant;\r\n /**\r\n * @default 'left'\r\n */\r\n align?: \"left\" | \"center\" | \"right\" | \"justify\";\r\n color?: string;\r\n /**\r\n * @default 'normal'\r\n */\r\n weight?: TextWeight;\r\n /**\r\n * @default false\r\n */\r\n italic?: boolean;\r\n /**\r\n * @default 'none'\r\n */\r\n decoration?: TextDecoration;\r\n transform?: \"uppercase\" | \"lowercase\" | \"capitalize\";\r\n /**\r\n * @default false\r\n */\r\n noMargin?: boolean;\r\n}\r\n\r\nconst createTextStyles = (t: PdfcnTheme) => {\r\n const { fontWeights, letterSpacing } = t.primitives;\r\n const base = {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n lineHeight: t.typography.body.lineHeight,\r\n marginBottom: t.spacing.paragraphGap,\r\n marginTop: 0,\r\n };\r\n return StyleSheet.create({\r\n \"2xl\": { ...base, fontSize: t.primitives.typography[\"2xl\"] },\r\n \"3xl\": { ...base, fontSize: t.primitives.typography[\"3xl\"] },\r\n base: { ...base, fontSize: t.primitives.typography.base },\r\n capitalize: { textTransform: \"capitalize\" },\r\n decorationNone: { textDecoration: \"none\" },\r\n italic: { fontStyle: \"italic\" },\r\n lg: { ...base, fontSize: t.primitives.typography.lg },\r\n lineThrough: { textDecoration: \"line-through\" },\r\n lowercase: { textTransform: \"lowercase\" },\r\n noMargin: { marginBottom: 0, marginTop: 0 },\r\n sm: { ...base, fontSize: t.primitives.typography.sm },\r\n text: { ...base, fontSize: t.typography.body.fontSize },\r\n underline: { textDecoration: \"underline\" },\r\n uppercase: {\r\n letterSpacing: letterSpacing.wider * 10,\r\n textTransform: \"uppercase\",\r\n },\r\n weightBold: { fontWeight: fontWeights.bold },\r\n weightMedium: { fontWeight: fontWeights.medium },\r\n weightNormal: { fontWeight: fontWeights.regular },\r\n weightSemibold: { fontWeight: fontWeights.semibold },\r\n xl: { ...base, fontSize: t.primitives.typography.xl },\r\n xs: { ...base, fontSize: t.primitives.typography.xs },\r\n });\r\n};\r\n\r\nexport const Text = ({\r\n variant,\r\n align,\r\n color,\r\n weight,\r\n italic,\r\n decoration,\r\n transform,\r\n noMargin,\r\n children,\r\n style,\r\n}: TextProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createTextStyles(theme), [theme]);\r\n const weightMap = {\r\n bold: styles.weightBold,\r\n medium: styles.weightMedium,\r\n normal: styles.weightNormal,\r\n semibold: styles.weightSemibold,\r\n };\r\n const decorationMap = {\r\n \"line-through\": styles.lineThrough,\r\n none: styles.decorationNone,\r\n underline: styles.underline,\r\n };\r\n const transformMap = {\r\n capitalize: styles.capitalize,\r\n lowercase: styles.lowercase,\r\n uppercase: styles.uppercase,\r\n };\r\n const styleArray: Style[] = [variant ? styles[variant] : styles.text];\r\n if (weight && weight in weightMap) {\r\n styleArray.push(weightMap[weight]);\r\n }\r\n if (italic) {\r\n styleArray.push(styles.italic);\r\n }\r\n if (decoration && decoration in decorationMap) {\r\n styleArray.push(decorationMap[decoration]);\r\n }\r\n if (transform && transform in transformMap) {\r\n styleArray.push(transformMap[transform]);\r\n }\r\n if (noMargin) {\r\n styleArray.push(styles.noMargin);\r\n }\r\n const semantic = {} as Style;\r\n if (align) {\r\n semantic.textAlign = align;\r\n }\r\n if (color) {\r\n semantic.color = resolveColor(color, theme.colors);\r\n }\r\n if (Object.keys(semantic).length > 0) {\r\n styleArray.push(semantic);\r\n }\r\n if (style) {\r\n styleArray.push(...[style].flat());\r\n }\r\n return <PDFText style={mergePdfStyles(styleArray)}>{children}</PDFText>;\r\n};\r\n",
+ "content": "import {\n mergePdfStyles,\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type TextVariant = \"xs\" | \"sm\" | \"base\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\";\nexport type TextWeight = \"normal\" | \"medium\" | \"semibold\" | \"bold\";\nexport type TextDecoration = \"underline\" | \"line-through\" | \"none\";\n\n/**\n * Body text with typography scale, alignment, and decoration options.\n * Props - `variant` | `align` | `color` | `weight` | `italic` | `decoration` | `transform` | `noMargin` | `children` | `style`\n * @see {@link TextProps}\n */\nexport interface TextProps extends PDFComponentProps {\n /**\n * @default 'base'\n */\n variant?: TextVariant;\n /**\n * @default 'left'\n */\n align?: \"left\" | \"center\" | \"right\" | \"justify\";\n color?: string;\n /**\n * @default 'normal'\n */\n weight?: TextWeight;\n /**\n * @default false\n */\n italic?: boolean;\n /**\n * @default 'none'\n */\n decoration?: TextDecoration;\n transform?: \"uppercase\" | \"lowercase\" | \"capitalize\";\n /**\n * @default false\n */\n noMargin?: boolean;\n}\n\nconst createTextStyles = (t: PdfcnTheme) => {\n const { fontWeights, letterSpacing } = t.primitives;\n const base = {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n lineHeight: t.typography.body.lineHeight,\n marginBottom: t.spacing.paragraphGap,\n marginTop: 0,\n };\n return StyleSheet.create({\n \"2xl\": { ...base, fontSize: t.primitives.typography[\"2xl\"] },\n \"3xl\": { ...base, fontSize: t.primitives.typography[\"3xl\"] },\n base: { ...base, fontSize: t.primitives.typography.base },\n capitalize: { textTransform: \"capitalize\" },\n decorationNone: { textDecoration: \"none\" },\n italic: { fontStyle: \"italic\" },\n lg: { ...base, fontSize: t.primitives.typography.lg },\n lineThrough: { textDecoration: \"line-through\" },\n lowercase: { textTransform: \"lowercase\" },\n noMargin: { marginBottom: 0, marginTop: 0 },\n sm: { ...base, fontSize: t.primitives.typography.sm },\n text: { ...base, fontSize: t.typography.body.fontSize },\n underline: { textDecoration: \"underline\" },\n uppercase: {\n letterSpacing: letterSpacing.wider * 10,\n textTransform: \"uppercase\",\n },\n weightBold: { fontWeight: fontWeights.bold },\n weightMedium: { fontWeight: fontWeights.medium },\n weightNormal: { fontWeight: fontWeights.regular },\n weightSemibold: { fontWeight: fontWeights.semibold },\n xl: { ...base, fontSize: t.primitives.typography.xl },\n xs: { ...base, fontSize: t.primitives.typography.xs },\n });\n};\n\nexport const Text = ({\n variant,\n align,\n color,\n weight,\n italic,\n decoration,\n transform,\n noMargin,\n children,\n style,\n}: TextProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createTextStyles(theme), [theme]);\n const weightMap = {\n bold: styles.weightBold,\n medium: styles.weightMedium,\n normal: styles.weightNormal,\n semibold: styles.weightSemibold,\n };\n const decorationMap = {\n \"line-through\": styles.lineThrough,\n none: styles.decorationNone,\n underline: styles.underline,\n };\n const transformMap = {\n capitalize: styles.capitalize,\n lowercase: styles.lowercase,\n uppercase: styles.uppercase,\n };\n const styleArray: Style[] = [variant ? styles[variant] : styles.text];\n if (weight && weight in weightMap) {\n styleArray.push(weightMap[weight]);\n }\n if (italic) {\n styleArray.push(styles.italic);\n }\n if (decoration && decoration in decorationMap) {\n styleArray.push(decorationMap[decoration]);\n }\n if (transform && transform in transformMap) {\n styleArray.push(transformMap[transform]);\n }\n if (noMargin) {\n styleArray.push(styles.noMargin);\n }\n const semantic = {} as Style;\n if (align) {\n semantic.textAlign = align;\n }\n if (color) {\n semantic.color = resolveColor(color, theme.colors);\n }\n if (Object.keys(semantic).length > 0) {\n styleArray.push(semantic);\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return <PDFText style={mergePdfStyles(styleArray)}>{children}</PDFText>;\n};\n",
"type": "registry:component",
"target": "components/pdf/text/text.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/theme-provider.json b/apps/web/public/r/forme/theme-provider.json
index 11266ff..b7bb5af 100644
--- a/apps/web/public/r/forme/theme-provider.json
+++ b/apps/web/public/r/forme/theme-provider.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/forme/components/theme-provider.tsx",
- "content": "import type { Style } from \"@formepdf/react\";\nimport { isValidElement } from \"react\";\nimport type { DependencyList, ReactNode } from \"react\";\n\nimport { professionalTheme } from \"@/registry/themes/professional\";\n\nexport type PdfcnTheme = typeof professionalTheme;\n\nlet serializedTheme = professionalTheme;\n\nexport interface PdfcnThemeProviderProps {\n theme?: PdfcnTheme;\n children: ReactNode;\n}\n\ntype PdfStyleInput = Style | PdfStyleInput[] | false | null | undefined;\n\nconst mergeStyleInput = (target: Style, input: PdfStyleInput): void => {\n if (Array.isArray(input)) {\n for (const item of input) {\n mergeStyleInput(target, item);\n }\n } else if (input) {\n Object.assign(target, input);\n }\n};\n\nexport const mergePdfStyles = (...inputs: PdfStyleInput[]): Style => {\n const merged: Style = {};\n for (const input of inputs) {\n mergeStyleInput(merged, input);\n }\n return merged;\n};\n\nconst renderForSerializer = (\n children: ReactNode,\n theme: PdfcnTheme\n): ReactNode => {\n serializedTheme = theme;\n\n if (!isValidElement(children) || typeof children.type !== \"function\") {\n return children;\n }\n if ((children.type as { __formeType?: string }).__formeType === \"Document\") {\n return children;\n }\n\n return (children.type as (props: unknown) => ReactNode)(children.props);\n};\n\nexport const PdfcnThemeProvider = ({\n theme,\n children,\n}: PdfcnThemeProviderProps) =>\n renderForSerializer(children, theme ?? professionalTheme);\n\nexport const usePdfcnTheme = (): PdfcnTheme => serializedTheme;\n\nexport const useSafeMemo = <T,>(factory: () => T, _deps: DependencyList): T =>\n factory();\n",
+ "content": "import type { Style } from \"@formepdf/react\";\nimport { isValidElement } from \"react\";\nimport type { DependencyList, ReactNode } from \"react\";\n\nimport { professionalTheme } from \"@/lib/pdf-themes/professional\";\n\nexport type PdfcnTheme = typeof professionalTheme;\n\nlet serializedTheme = professionalTheme;\n\nexport interface PdfcnThemeProviderProps {\n theme?: PdfcnTheme;\n children: ReactNode;\n}\n\ntype PdfStyleInput = Style | PdfStyleInput[] | false | null | undefined;\n\nconst mergeStyleInput = (target: Style, input: PdfStyleInput): void => {\n if (Array.isArray(input)) {\n for (const item of input) {\n mergeStyleInput(target, item);\n }\n } else if (input) {\n Object.assign(target, input);\n }\n};\n\nexport const mergePdfStyles = (...inputs: PdfStyleInput[]): Style => {\n const merged: Style = {};\n for (const input of inputs) {\n mergeStyleInput(merged, input);\n }\n return merged;\n};\n\nconst renderForSerializer = (\n children: ReactNode,\n theme: PdfcnTheme\n): ReactNode => {\n serializedTheme = theme;\n\n if (!isValidElement(children) || typeof children.type !== \"function\") {\n return children;\n }\n if ((children.type as { __formeType?: string }).__formeType === \"Document\") {\n return children;\n }\n\n return (children.type as (props: unknown) => ReactNode)(children.props);\n};\n\nexport const PdfcnThemeProvider = ({\n theme,\n children,\n}: PdfcnThemeProviderProps) =>\n renderForSerializer(children, theme ?? professionalTheme);\n\nexport const usePdfcnTheme = (): PdfcnTheme => serializedTheme;\n\nexport const useSafeMemo = <T,>(factory: () => T, _deps: DependencyList): T =>\n factory();\n",
"type": "registry:lib",
"target": "components/pdf/theme-provider.tsx"
}
],
"type": "registry:lib"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/utils.json b/apps/web/public/r/forme/utils.json
index 8f54321..b4c6af4 100644
--- a/apps/web/public/r/forme/utils.json
+++ b/apps/web/public/r/forme/utils.json
@@ -13,34 +13,34 @@
"files": [
{
"path": "registry/bases/forme/lib/resolve-color.ts",
- "content": "import type { ColorTokens } from \"@/registry/types/pdf-themes\";\r\n\r\n/** Theme color token keys that can be used for the color prop */\r\nexport const THEME_COLOR_KEYS = [\r\n \"foreground\",\r\n \"background\",\r\n \"muted\",\r\n \"mutedForeground\",\r\n \"primary\",\r\n \"primaryForeground\",\r\n \"border\",\r\n \"accent\",\r\n \"destructive\",\r\n \"success\",\r\n \"warning\",\r\n \"info\",\r\n] as const satisfies (keyof ColorTokens)[];\r\n\r\n/** Resolves a color value: theme token key → hex, or raw CSS color as-is. */\r\nexport const resolveColor = (value: string, colors: ColorTokens): string => {\r\n const key = value as (typeof THEME_COLOR_KEYS)[number];\r\n return THEME_COLOR_KEYS.includes(key) ? colors[key] : value;\r\n};\r\n",
+ "content": "import type { ColorTokens } from \"@/types/pdf-themes\";\n\n/** Theme color token keys that can be used for the color prop */\nexport const THEME_COLOR_KEYS = [\n \"foreground\",\n \"background\",\n \"muted\",\n \"mutedForeground\",\n \"primary\",\n \"primaryForeground\",\n \"border\",\n \"accent\",\n \"destructive\",\n \"success\",\n \"warning\",\n \"info\",\n] as const satisfies (keyof ColorTokens)[];\n\n/** Resolves a color value: theme token key → hex, or raw CSS color as-is. */\nexport const resolveColor = (value: string, colors: ColorTokens): string => {\n const key = value as (typeof THEME_COLOR_KEYS)[number];\n return THEME_COLOR_KEYS.includes(key) ? colors[key] : value;\n};\n",
"type": "registry:lib",
"target": "lib/resolve-color.ts"
},
{
"path": "registry/bases/forme/lib/maybe-fixed.tsx",
- "content": "import type { ReactNode } from \"react\";\r\n\r\nimport { Fixed, View } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\n\r\nexport const MaybeFixed = ({\r\n fixed,\r\n position,\r\n wrap,\r\n style,\r\n children,\r\n}: {\r\n fixed?: boolean;\r\n position: \"header\" | \"footer\";\r\n wrap?: boolean;\r\n style?: Style | Style[];\r\n children?: ReactNode;\r\n}) => {\r\n const view = (\r\n <View wrap={wrap} style={style as never}>\r\n {children}\r\n </View>\r\n );\r\n if (!fixed) {\r\n return view;\r\n }\r\n return <Fixed position={position}>{view}</Fixed>;\r\n};\r\n",
+ "content": "import type { ReactNode } from \"react\";\n\nimport { Fixed, View } from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\n\nexport const MaybeFixed = ({\n fixed,\n position,\n wrap,\n style,\n children,\n}: {\n fixed?: boolean;\n position: \"header\" | \"footer\";\n wrap?: boolean;\n style?: Style | Style[];\n children?: ReactNode;\n}) => {\n const view = (\n <View wrap={wrap} style={style as never}>\n {children}\n </View>\n );\n if (!fixed) {\n return view;\n }\n return <Fixed position={position}>{view}</Fixed>;\n};\n",
"type": "registry:lib",
"target": "lib/maybe-fixed.tsx"
},
{
"path": "registry/bases/forme/components/theme-provider.tsx",
- "content": "import type { Style } from \"@formepdf/react\";\r\nimport { isValidElement } from \"react\";\r\nimport type { DependencyList, ReactNode } from \"react\";\r\n\r\nimport { professionalTheme } from \"@/registry/themes/professional\";\r\n\r\nexport type PdfcnTheme = typeof professionalTheme;\r\n\r\nlet serializedTheme = professionalTheme;\r\n\r\nexport interface PdfcnThemeProviderProps {\r\n theme?: PdfcnTheme;\r\n children: ReactNode;\r\n}\r\n\r\ntype PdfStyleInput = Style | PdfStyleInput[] | false | null | undefined;\r\n\r\nconst mergeStyleInput = (target: Style, input: PdfStyleInput): void => {\r\n if (Array.isArray(input)) {\r\n for (const item of input) {\r\n mergeStyleInput(target, item);\r\n }\r\n } else if (input) {\r\n Object.assign(target, input);\r\n }\r\n};\r\n\r\nexport const mergePdfStyles = (...inputs: PdfStyleInput[]): Style => {\r\n const merged: Style = {};\r\n for (const input of inputs) {\r\n mergeStyleInput(merged, input);\r\n }\r\n return merged;\r\n};\r\n\r\nconst renderForSerializer = (\r\n children: ReactNode,\r\n theme: PdfcnTheme\r\n): ReactNode => {\r\n serializedTheme = theme;\r\n\r\n if (!isValidElement(children) || typeof children.type !== \"function\") {\r\n return children;\r\n }\r\n if ((children.type as { __formeType?: string }).__formeType === \"Document\") {\r\n return children;\r\n }\r\n\r\n return (children.type as (props: unknown) => ReactNode)(children.props);\r\n};\r\n\r\nexport const PdfcnThemeProvider = ({\r\n theme,\r\n children,\r\n}: PdfcnThemeProviderProps) =>\r\n renderForSerializer(children, theme ?? professionalTheme);\r\n\r\nexport const usePdfcnTheme = (): PdfcnTheme => serializedTheme;\r\n\r\nexport const useSafeMemo = <T,>(factory: () => T, _deps: DependencyList): T =>\r\n factory();\r\n",
+ "content": "import type { Style } from \"@formepdf/react\";\nimport { isValidElement } from \"react\";\nimport type { DependencyList, ReactNode } from \"react\";\n\nimport { professionalTheme } from \"@/lib/pdf-themes/professional\";\n\nexport type PdfcnTheme = typeof professionalTheme;\n\nlet serializedTheme = professionalTheme;\n\nexport interface PdfcnThemeProviderProps {\n theme?: PdfcnTheme;\n children: ReactNode;\n}\n\ntype PdfStyleInput = Style | PdfStyleInput[] | false | null | undefined;\n\nconst mergeStyleInput = (target: Style, input: PdfStyleInput): void => {\n if (Array.isArray(input)) {\n for (const item of input) {\n mergeStyleInput(target, item);\n }\n } else if (input) {\n Object.assign(target, input);\n }\n};\n\nexport const mergePdfStyles = (...inputs: PdfStyleInput[]): Style => {\n const merged: Style = {};\n for (const input of inputs) {\n mergeStyleInput(merged, input);\n }\n return merged;\n};\n\nconst renderForSerializer = (\n children: ReactNode,\n theme: PdfcnTheme\n): ReactNode => {\n serializedTheme = theme;\n\n if (!isValidElement(children) || typeof children.type !== \"function\") {\n return children;\n }\n if ((children.type as { __formeType?: string }).__formeType === \"Document\") {\n return children;\n }\n\n return (children.type as (props: unknown) => ReactNode)(children.props);\n};\n\nexport const PdfcnThemeProvider = ({\n theme,\n children,\n}: PdfcnThemeProviderProps) =>\n renderForSerializer(children, theme ?? professionalTheme);\n\nexport const usePdfcnTheme = (): PdfcnTheme => serializedTheme;\n\nexport const useSafeMemo = <T,>(factory: () => T, _deps: DependencyList): T =>\n factory();\n",
"type": "registry:lib",
"target": "components/pdf/theme-provider.tsx"
},
{
"path": "registry/bases/forme/lib/pdf-primitives.tsx",
- "content": "import {\r\n Fixed as FormeFixed,\r\n Image as FormeImage,\r\n Link as FormeLink,\r\n StyleSheet,\r\n Text as FormeText,\r\n View as FormeView,\r\n} from \"@formepdf/react\";\r\nimport type {\r\n FixedProps,\r\n ImageProps,\r\n LinkProps,\r\n Style,\r\n TextProps,\r\n ViewProps,\r\n} from \"@formepdf/react\";\r\n\r\nexport type FormeStyleInput =\r\n | Style\r\n | false\r\n | null\r\n | undefined\r\n | readonly FormeStyleInput[];\r\n\r\nexport const mergeFormeStyles = (input: FormeStyleInput): Style | undefined => {\r\n if (!input) {\r\n return undefined;\r\n }\r\n\r\n if (!Array.isArray(input)) {\r\n return input as Style;\r\n }\r\n\r\n const merged: Style = {};\r\n for (const entry of input) {\r\n const resolved = mergeFormeStyles(entry);\r\n if (resolved) {\r\n Object.assign(merged, resolved);\r\n }\r\n }\r\n\r\n return Object.keys(merged).length > 0 ? merged : undefined;\r\n};\r\n\r\ntype WithStyle<T> = Omit<T, \"style\"> & { style?: FormeStyleInput };\r\n\r\nexport const View = ({ style, ...props }: WithStyle<ViewProps>) => (\r\n <FormeView {...props} style={mergeFormeStyles(style)} />\r\n);\r\n\r\nexport const Text = ({ style, ...props }: WithStyle<TextProps>) => (\r\n <FormeText {...props} style={mergeFormeStyles(style)} />\r\n);\r\n\r\nexport const Link = ({ style, ...props }: WithStyle<LinkProps>) => (\r\n <FormeLink {...props} style={mergeFormeStyles(style)} />\r\n);\r\n\r\nexport const Image = ({ style, ...props }: WithStyle<ImageProps>) => (\r\n <FormeImage {...props} style={mergeFormeStyles(style)} />\r\n);\r\n\r\nexport const Fixed = ({ style, ...props }: WithStyle<FixedProps>) => (\r\n <FormeFixed {...props} style={mergeFormeStyles(style)} />\r\n);\r\n\r\nexport { StyleSheet };\r\nexport type { Style };\r\n",
+ "content": "import {\n Fixed as FormeFixed,\n Image as FormeImage,\n Link as FormeLink,\n StyleSheet,\n Text as FormeText,\n View as FormeView,\n} from \"@formepdf/react\";\nimport type {\n FixedProps,\n ImageProps,\n LinkProps,\n Style,\n TextProps,\n ViewProps,\n} from \"@formepdf/react\";\n\nexport type FormeStyleInput =\n | Style\n | false\n | null\n | undefined\n | readonly FormeStyleInput[];\n\nexport const mergeFormeStyles = (input: FormeStyleInput): Style | undefined => {\n if (!input) {\n return undefined;\n }\n\n if (!Array.isArray(input)) {\n return input as Style;\n }\n\n const merged: Style = {};\n for (const entry of input) {\n const resolved = mergeFormeStyles(entry);\n if (resolved) {\n Object.assign(merged, resolved);\n }\n }\n\n return Object.keys(merged).length > 0 ? merged : undefined;\n};\n\ntype WithStyle<T> = Omit<T, \"style\"> & { style?: FormeStyleInput };\n\nexport const View = ({ style, ...props }: WithStyle<ViewProps>) => (\n <FormeView {...props} style={mergeFormeStyles(style)} />\n);\n\nexport const Text = ({ style, ...props }: WithStyle<TextProps>) => (\n <FormeText {...props} style={mergeFormeStyles(style)} />\n);\n\nexport const Link = ({ style, ...props }: WithStyle<LinkProps>) => (\n <FormeLink {...props} style={mergeFormeStyles(style)} />\n);\n\nexport const Image = ({ style, ...props }: WithStyle<ImageProps>) => (\n <FormeImage {...props} style={mergeFormeStyles(style)} />\n);\n\nexport const Fixed = ({ style, ...props }: WithStyle<FixedProps>) => (\n <FormeFixed {...props} style={mergeFormeStyles(style)} />\n);\n\nexport { StyleSheet };\nexport type { Style };\n",
"type": "registry:lib",
"target": "lib/pdf-primitives.tsx"
},
{
"path": "registry/bases/forme/lib/pdf-svg.tsx",
- "content": "import { Svg as FormeSvg } from \"@formepdf/react\";\r\nimport {\r\n Children,\r\n Fragment,\r\n cloneElement,\r\n createElement,\r\n isValidElement,\r\n} from \"react\";\r\nimport type { ReactNode, CSSProperties } from \"react\";\r\n\r\ntype AnyProps = Record<string, unknown> & {\r\n children?: ReactNode;\r\n style?: CSSProperties;\r\n};\r\n\r\nconst SVG_ATTRIBUTE_NAMES: Record<string, string> = {\r\n className: \"class\",\r\n dominantBaseline: \"dominant-baseline\",\r\n fillOpacity: \"fill-opacity\",\r\n fontFamily: \"font-family\",\r\n fontSize: \"font-size\",\r\n fontStyle: \"font-style\",\r\n fontWeight: \"font-weight\",\r\n strokeDasharray: \"stroke-dasharray\",\r\n strokeLinecap: \"stroke-linecap\",\r\n strokeLinejoin: \"stroke-linejoin\",\r\n strokeOpacity: \"stroke-opacity\",\r\n strokeWidth: \"stroke-width\",\r\n textAnchor: \"text-anchor\",\r\n};\r\n\r\nconst normalizeSvgProps = (props: AnyProps): AnyProps => {\r\n const normalized: AnyProps = {};\r\n\r\n for (const [name, value] of Object.entries(props)) {\r\n if (value === undefined) {\r\n continue;\r\n }\r\n\r\n if (name === \"style\" && value && typeof value === \"object\") {\r\n for (const [styleName, styleValue] of Object.entries(value)) {\r\n normalized[SVG_ATTRIBUTE_NAMES[styleName] ?? styleName] = styleValue;\r\n }\r\n continue;\r\n }\r\n\r\n normalized[SVG_ATTRIBUTE_NAMES[name] ?? name] = value;\r\n }\r\n\r\n return normalized;\r\n};\r\n\r\nconst resolveSvgChildren = (children: ReactNode): ReactNode =>\r\n Children.map(children, (child) => {\r\n if (!isValidElement<AnyProps>(child)) {\r\n return child;\r\n }\r\n\r\n if (typeof child.type === \"function\") {\r\n const resolved = (child.type as (props: AnyProps) => ReactNode)(\r\n child.props\r\n );\r\n return resolveSvgChildren(resolved);\r\n }\r\n\r\n if ((child.type as unknown) === Fragment) {\r\n return resolveSvgChildren(child.props.children);\r\n }\r\n\r\n if (child.props.children === undefined) {\r\n return child;\r\n }\r\n\r\n return cloneElement(\r\n child,\r\n undefined,\r\n resolveSvgChildren(child.props.children)\r\n );\r\n });\r\n\r\nexport const Svg = ({\r\n children,\r\n width,\r\n height,\r\n viewBox,\r\n style,\r\n ...rest\r\n}: AnyProps & { width?: number; height?: number; viewBox?: string }) => (\r\n <FormeSvg\r\n width={width as number}\r\n height={height as number}\r\n viewBox={viewBox as string | undefined}\r\n style={style as never}\r\n {...rest}\r\n >\r\n {resolveSvgChildren(children)}\r\n </FormeSvg>\r\n);\r\n\r\nexport const Circle = (props: AnyProps) =>\r\n createElement(\"circle\", normalizeSvgProps(props));\r\nexport const Rect = (props: AnyProps) =>\r\n createElement(\"rect\", normalizeSvgProps(props));\r\nexport const G = (props: AnyProps) =>\r\n createElement(\"g\", normalizeSvgProps(props));\r\nexport const Line = (props: AnyProps) =>\r\n createElement(\"line\", normalizeSvgProps(props));\r\nexport const Path = (props: AnyProps) =>\r\n createElement(\"path\", normalizeSvgProps(props));\r\nexport const SvgText = (props: AnyProps) =>\r\n createElement(\r\n \"text\",\r\n normalizeSvgProps({ fontFamily: \"sans-serif\", ...props })\r\n );\r\n",
+ "content": "import { Svg as FormeSvg } from \"@formepdf/react\";\nimport {\n Children,\n Fragment,\n cloneElement,\n createElement,\n isValidElement,\n} from \"react\";\nimport type { ReactNode, CSSProperties } from \"react\";\n\ntype AnyProps = Record<string, unknown> & {\n children?: ReactNode;\n style?: CSSProperties;\n};\n\nconst SVG_ATTRIBUTE_NAMES: Record<string, string> = {\n className: \"class\",\n dominantBaseline: \"dominant-baseline\",\n fillOpacity: \"fill-opacity\",\n fontFamily: \"font-family\",\n fontSize: \"font-size\",\n fontStyle: \"font-style\",\n fontWeight: \"font-weight\",\n strokeDasharray: \"stroke-dasharray\",\n strokeLinecap: \"stroke-linecap\",\n strokeLinejoin: \"stroke-linejoin\",\n strokeOpacity: \"stroke-opacity\",\n strokeWidth: \"stroke-width\",\n textAnchor: \"text-anchor\",\n};\n\nconst normalizeSvgProps = (props: AnyProps): AnyProps => {\n const normalized: AnyProps = {};\n\n for (const [name, value] of Object.entries(props)) {\n if (value === undefined) {\n continue;\n }\n\n if (name === \"style\" && value && typeof value === \"object\") {\n for (const [styleName, styleValue] of Object.entries(value)) {\n normalized[SVG_ATTRIBUTE_NAMES[styleName] ?? styleName] = styleValue;\n }\n continue;\n }\n\n normalized[SVG_ATTRIBUTE_NAMES[name] ?? name] = value;\n }\n\n return normalized;\n};\n\nconst resolveSvgChildren = (children: ReactNode): ReactNode =>\n Children.map(children, (child) => {\n if (!isValidElement<AnyProps>(child)) {\n return child;\n }\n\n if (typeof child.type === \"function\") {\n const resolved = (child.type as (props: AnyProps) => ReactNode)(\n child.props\n );\n return resolveSvgChildren(resolved);\n }\n\n if ((child.type as unknown) === Fragment) {\n return resolveSvgChildren(child.props.children);\n }\n\n if (child.props.children === undefined) {\n return child;\n }\n\n return cloneElement(\n child,\n undefined,\n resolveSvgChildren(child.props.children)\n );\n });\n\nexport const Svg = ({\n children,\n width,\n height,\n viewBox,\n style,\n ...rest\n}: AnyProps & { width?: number; height?: number; viewBox?: string }) => (\n <FormeSvg\n width={width as number}\n height={height as number}\n viewBox={viewBox as string | undefined}\n style={style as never}\n {...rest}\n >\n {resolveSvgChildren(children)}\n </FormeSvg>\n);\n\nexport const Circle = (props: AnyProps) =>\n createElement(\"circle\", normalizeSvgProps(props));\nexport const Rect = (props: AnyProps) =>\n createElement(\"rect\", normalizeSvgProps(props));\nexport const G = (props: AnyProps) =>\n createElement(\"g\", normalizeSvgProps(props));\nexport const Line = (props: AnyProps) =>\n createElement(\"line\", normalizeSvgProps(props));\nexport const Path = (props: AnyProps) =>\n createElement(\"path\", normalizeSvgProps(props));\nexport const SvgText = (props: AnyProps) =>\n createElement(\n \"text\",\n normalizeSvgProps({ fontFamily: \"sans-serif\", ...props })\n );\n",
"type": "registry:lib",
"target": "lib/pdf-svg.tsx"
}
],
"type": "registry:lib"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/watermark.json b/apps/web/public/r/forme/watermark.json
index a2cd554..6cd1a68 100644
--- a/apps/web/public/r/forme/watermark.json
+++ b/apps/web/public/r/forme/watermark.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/forme/components/watermark/watermark.tsx",
- "content": "import { Watermark as FormeWatermark } from \"@formepdf/react\";\r\n\r\nimport { usePdfcnTheme } from \"@/registry/bases/forme/components/theme-provider\";\r\nimport { mergeFormeStyles } from \"@/registry/bases/forme/lib/pdf-primitives\";\r\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\n\r\nexport type WatermarkPosition =\r\n | \"center\"\r\n | \"top-left\"\r\n | \"top-right\"\r\n | \"bottom-left\"\r\n | \"bottom-right\";\r\n\r\n/**\r\n * Diagonal watermark overlaid across the full page using absolute positioning.\r\n * Props - `text` | `opacity` | `fontSize` | `color` | `angle` | `position` | `fixed` | `style`\r\n * @see {@link PdfWatermarkProps}\r\n */\r\nexport interface PdfWatermarkProps extends Omit<PDFComponentProps, \"children\"> {\r\n text: string;\r\n opacity?: number;\r\n fontSize?: number;\r\n color?: string;\r\n angle?: number;\r\n position?: WatermarkPosition;\r\n /**\r\n * @default true\r\n */\r\n fixed?: boolean;\r\n children?: never;\r\n}\r\n\r\nconst withOpacity = (color: string, opacity: number): string => {\r\n const match = color.match(/^#([\\da-f]{2})([\\da-f]{2})([\\da-f]{2})$/i);\r\n if (!match) {\r\n return color;\r\n }\r\n\r\n const [, red, green, blue] = match;\r\n return `rgba(${Number.parseInt(red, 16)}, ${Number.parseInt(green, 16)}, ${Number.parseInt(blue, 16)}, ${opacity})`;\r\n};\r\n\r\nexport const PdfWatermark = ({\r\n text,\r\n opacity = 0.15,\r\n fontSize = 60,\r\n color = \"mutedForeground\",\r\n angle = -45,\r\n style,\r\n}: PdfWatermarkProps) => {\r\n const theme = usePdfcnTheme();\r\n const resolvedColor = resolveColor(color, theme.colors);\r\n\r\n return (\r\n <FormeWatermark\r\n text={text}\r\n angle={angle}\r\n color={withOpacity(resolvedColor, opacity)}\r\n fontSize={fontSize}\r\n style={mergeFormeStyles(style)}\r\n />\r\n );\r\n};\r\n",
+ "content": "import { Watermark as FormeWatermark } from \"@formepdf/react\";\n\nimport { usePdfcnTheme } from \"@/components/pdf/theme-provider\";\nimport { mergeFormeStyles } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\n\nexport type WatermarkPosition =\n | \"center\"\n | \"top-left\"\n | \"top-right\"\n | \"bottom-left\"\n | \"bottom-right\";\n\n/**\n * Diagonal watermark overlaid across the full page using absolute positioning.\n * Props - `text` | `opacity` | `fontSize` | `color` | `angle` | `position` | `fixed` | `style`\n * @see {@link PdfWatermarkProps}\n */\nexport interface PdfWatermarkProps extends Omit<PDFComponentProps, \"children\"> {\n text: string;\n opacity?: number;\n fontSize?: number;\n color?: string;\n angle?: number;\n position?: WatermarkPosition;\n /**\n * @default true\n */\n fixed?: boolean;\n children?: never;\n}\n\nconst withOpacity = (color: string, opacity: number): string => {\n const match = color.match(/^#([\\da-f]{2})([\\da-f]{2})([\\da-f]{2})$/i);\n if (!match) {\n return color;\n }\n\n const [, red, green, blue] = match;\n return `rgba(${Number.parseInt(red, 16)}, ${Number.parseInt(green, 16)}, ${Number.parseInt(blue, 16)}, ${opacity})`;\n};\n\nexport const PdfWatermark = ({\n text,\n opacity = 0.15,\n fontSize = 60,\n color = \"mutedForeground\",\n angle = -45,\n style,\n}: PdfWatermarkProps) => {\n const theme = usePdfcnTheme();\n const resolvedColor = resolveColor(color, theme.colors);\n\n return (\n <FormeWatermark\n text={text}\n angle={angle}\n color={withOpacity(resolvedColor, opacity)}\n fontSize={fontSize}\n style={mergeFormeStyles(style)}\n />\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/watermark/watermark.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/forme/work-order.json b/apps/web/public/r/forme/work-order.json
index cb409a3..3d43df2 100644
--- a/apps/web/public/r/forme/work-order.json
+++ b/apps/web/public/r/forme/work-order.json
@@ -22,7 +22,7 @@
"files": [
{
"path": "registry/bases/forme/blocks/work-order/work-order.tsx",
- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { Badge } from \"@/registry/bases/forme/components/badge/badge\";\nimport type { BadgeVariant } from \"@/registry/bases/forme/components/badge/badge\";\nimport { KeyValue } from \"@/registry/bases/forme/components/key-value/key-value\";\nimport { PageFooter } from \"@/registry/bases/forme/components/page-footer/page-footer\";\nimport { PageHeader } from \"@/registry/bases/forme/components/page-header/page-header\";\nimport { PdfImage } from \"@/registry/bases/forme/components/pdf-image/pdf-image\";\nimport { Section } from \"@/registry/bases/forme/components/section/section\";\nimport { PdfSignatureBlock } from \"@/registry/bases/forme/components/signature/signature\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/registry/bases/forme/components/table/table\";\nimport { Text } from \"@/registry/bases/forme/components/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type { WorkOrderData, WorkOrderPriority } from \"./work-order.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: WorkOrderData = {\n accentColor: \"#ea580c\",\n companyName: \"FixIt Pro Services\",\n customer: {\n accountNumber: \"ACC-10234\",\n address: \"789 Elm St, Austin, TX 78701\",\n name: \"Riverside Apartments\",\n phone: \"(512) 555-0199\",\n },\n customerNotes: \"Please service before end of month lease inspection.\",\n date: \"September 10, 2026\",\n equipment: {\n description: \"Commercial Dishwasher\",\n location: \"Kitchen — Unit 4B\",\n makeModel: \"Bosch SHP878ZD5N\",\n serialNumber: \"BSH-2024-88712\",\n },\n jobType: \"Repair\",\n labor: [\n {\n description: \"Diagnosis and repair\",\n hours: 2.5,\n rate: 95,\n technician: \"Mike Torres\",\n },\n ],\n parts: [\n {\n description: \"Drain Pump Assembly\",\n partNumber: \"PUMP-001\",\n qty: 1,\n unitPrice: 89.99,\n },\n {\n description: \"Drain Hose Kit\",\n partNumber: \"HOSE-012\",\n qty: 1,\n unitPrice: 24.5,\n },\n ],\n priority: \"High\",\n taxRate: 0.0825,\n technician: \"Mike Torres\",\n technicianNotes:\n \"Found clogged drain pump. Replaced pump and hose. Unit tested OK.\",\n warrantyInfo: \"90-day warranty on parts and labor.\",\n workOrderNumber: \"WO-2026-0452\",\n};\n\nconst PRIORITY_BADGE_VARIANT: Record<WorkOrderPriority, BadgeVariant> = {\n High: \"warning\",\n Low: \"default\",\n Medium: \"info\",\n Urgent: \"destructive\",\n};\n\nconst WorkOrderContent = ({ data }: { data: WorkOrderData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n checkbox: {\n borderColor: theme.colors.foreground,\n borderStyle: \"solid\",\n borderWidth: 1,\n height: 10,\n width: 10,\n },\n checkboxRow: {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 6,\n marginTop: theme.spacing.componentGap,\n },\n col: {\n flex: 1,\n paddingRight: 15,\n },\n label: {\n fontSize: 9,\n fontWeight: \"bold\",\n marginBottom: 2,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n row: {\n flexDirection: \"row\",\n },\n section: {\n marginBottom: theme.spacing.componentGap,\n },\n sectionSpaced: {\n marginBottom: theme.spacing.componentGap,\n marginTop: theme.spacing.componentGap,\n },\n signature: {\n marginBottom: 0,\n marginTop: 0,\n },\n });\n\n const partsTotal = data.parts.reduce(\n (sum, part) => sum + part.qty * part.unitPrice,\n 0\n );\n const laborTotal = data.labor.reduce(\n (sum, item) => sum + item.hours * item.rate,\n 0\n );\n const taxRate = data.taxRate ?? 0;\n const tax = (partsTotal + laborTotal) * taxRate;\n const grandTotal = partsTotal + laborTotal + tax;\n\n return (\n <Document title={`Work Order ${data.workOrderNumber}`}>\n <Page\n margin={{\n bottom: theme.spacing.page.marginBottom,\n left: theme.spacing.page.marginLeft,\n right: theme.spacing.page.marginRight,\n top: theme.spacing.page.marginTop,\n }}\n size=\"A4\"\n >\n <PageFooter\n leftText={data.warrantyInfo}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"logo-left\"\n logo={\n data.companyLogo ? (\n <PdfImage src={data.companyLogo} style={{ margin: 0 }} />\n ) : undefined\n }\n title={data.companyName}\n subtitle=\"Work Order\"\n rightText={`WO #${data.workOrderNumber}`}\n rightSubText={`Date: ${data.date}`}\n style={styles.section}\n />\n\n <Section\n noWrap\n spacing=\"none\"\n style={{\n ...styles.row,\n ...styles.section,\n alignItems: \"center\",\n justifyContent: \"space-between\",\n }}\n >\n <View\n style={{ alignItems: \"center\", flexDirection: \"row\", gap: 8 }}\n >\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\" }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Priority\n </Text>\n <Badge\n label={data.priority}\n variant={PRIORITY_BADGE_VARIANT[data.priority]}\n size=\"sm\"\n />\n </View>\n <Badge label={data.jobType} variant=\"outline\" size=\"sm\" />\n </Section>\n\n <Section\n noWrap\n spacing=\"none\"\n style={{ ...styles.row, ...styles.section }}\n >\n <View style={styles.col}>\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Customer\n </Text>\n <Text noMargin variant=\"xs\">\n {data.customer.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.customer.address}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.customer.phone}\n </Text>\n {data.customer.email ? (\n <Text noMargin variant=\"xs\">\n {data.customer.email}\n </Text>\n ) : null}\n {data.customer.accountNumber ? (\n <Text noMargin variant=\"xs\">\n {`Acct #: ${data.customer.accountNumber}`}\n </Text>\n ) : null}\n </View>\n <View style={styles.col}>\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Job Info\n </Text>\n <Text noMargin variant=\"xs\">\n {`Technician: ${data.technician}`}\n </Text>\n <Text noMargin variant=\"xs\">\n {`Job Type: ${data.jobType}`}\n </Text>\n </View>\n <View style={styles.col}>\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Equipment\n </Text>\n <Text noMargin variant=\"xs\">\n {data.equipment.description}\n </Text>\n {data.equipment.makeModel ? (\n <Text noMargin variant=\"xs\">\n {data.equipment.makeModel}\n </Text>\n ) : null}\n {data.equipment.serialNumber ? (\n <Text noMargin variant=\"xs\">\n {`S/N: ${data.equipment.serialNumber}`}\n </Text>\n ) : null}\n {data.equipment.location ? (\n <Text noMargin variant=\"xs\">\n {`Location: ${data.equipment.location}`}\n </Text>\n ) : null}\n </View>\n </Section>\n\n <Section spacing=\"none\">\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Parts Used\n </Text>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Part #</TableCell>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Unit Price</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.parts.map((part, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: parts have no stable id\n <TableRow key={index}>\n <TableCell>{part.partNumber}</TableCell>\n <TableCell>{part.description}</TableCell>\n <TableCell align=\"center\">{`${part.qty}`}</TableCell>\n <TableCell align=\"right\">{`$${part.unitPrice.toFixed(2)}`}</TableCell>\n <TableCell align=\"right\">{`$${(part.qty * part.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </Section>\n\n <Section spacing=\"none\">\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Labor\n </Text>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell>Technician</TableCell>\n <TableCell align=\"center\">Hours</TableCell>\n <TableCell align=\"right\">Rate</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.labor.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: labor entries have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell>{item.technician}</TableCell>\n <TableCell align=\"center\">{`${item.hours}`}</TableCell>\n <TableCell align=\"right\">{`$${item.rate.toFixed(2)}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.hours * item.rate).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </Section>\n\n <Section\n noWrap\n spacing=\"none\"\n style={{ ...styles.row, ...styles.section }}\n >\n <View style={{ flex: 1, paddingRight: 15 }}>\n {data.technicianNotes ? (\n <View>\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Technician Notes\n </Text>\n <Text noMargin variant=\"xs\">\n {data.technicianNotes}\n </Text>\n </View>\n ) : null}\n </View>\n <View style={{ marginLeft: \"auto\", width: 200 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n { key: \"Parts Total\", value: `$${partsTotal.toFixed(2)}` },\n { key: \"Labor Total\", value: `$${laborTotal.toFixed(2)}` },\n {\n key: `Tax (${(taxRate * 100).toFixed(2)}%)`,\n value: `$${tax.toFixed(2)}`,\n },\n {\n key: \"Grand Total\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${grandTotal.toFixed(2)}`,\n valueStyle: { fontSize: 12, fontWeight: \"bold\" },\n },\n ]}\n divided\n />\n </View>\n </Section>\n\n {data.customerNotes ? (\n <Section spacing=\"none\" style={styles.sectionSpaced}>\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Customer Notes\n </Text>\n <Text noMargin variant=\"xs\">\n {data.customerNotes}\n </Text>\n </Section>\n ) : null}\n\n <Section spacing=\"none\">\n <PdfSignatureBlock\n variant=\"double\"\n signers={[\n { date: data.date, label: \"Customer Signature\" },\n {\n date: data.date,\n label: \"Technician Signature\",\n name: data.technician,\n },\n ]}\n style={styles.signature}\n />\n <View style={styles.checkboxRow}>\n <View style={styles.checkbox} />\n <Text noMargin variant=\"xs\">\n Customer approves work performed and charges above\n </Text>\n </View>\n </Section>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const WorkOrderDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: WorkOrderData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <WorkOrderContent data={data} />\n </PdfcnThemeProvider>\n);\n",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { Badge } from \"@/components/pdf/badge/badge\";\nimport type { BadgeVariant } from \"@/components/pdf/badge/badge\";\nimport { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { PdfImage } from \"@/components/pdf/pdf-image/pdf-image\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport { PdfSignatureBlock } from \"@/components/pdf/signature/signature\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { WorkOrderData, WorkOrderPriority } from \"./work-order.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: WorkOrderData = {\n accentColor: \"#ea580c\",\n companyName: \"FixIt Pro Services\",\n customer: {\n accountNumber: \"ACC-10234\",\n address: \"789 Elm St, Austin, TX 78701\",\n name: \"Riverside Apartments\",\n phone: \"(512) 555-0199\",\n },\n customerNotes: \"Please service before end of month lease inspection.\",\n date: \"September 10, 2026\",\n equipment: {\n description: \"Commercial Dishwasher\",\n location: \"Kitchen — Unit 4B\",\n makeModel: \"Bosch SHP878ZD5N\",\n serialNumber: \"BSH-2024-88712\",\n },\n jobType: \"Repair\",\n labor: [\n {\n description: \"Diagnosis and repair\",\n hours: 2.5,\n rate: 95,\n technician: \"Mike Torres\",\n },\n ],\n parts: [\n {\n description: \"Drain Pump Assembly\",\n partNumber: \"PUMP-001\",\n qty: 1,\n unitPrice: 89.99,\n },\n {\n description: \"Drain Hose Kit\",\n partNumber: \"HOSE-012\",\n qty: 1,\n unitPrice: 24.5,\n },\n ],\n priority: \"High\",\n taxRate: 0.0825,\n technician: \"Mike Torres\",\n technicianNotes:\n \"Found clogged drain pump. Replaced pump and hose. Unit tested OK.\",\n warrantyInfo: \"90-day warranty on parts and labor.\",\n workOrderNumber: \"WO-2026-0452\",\n};\n\nconst PRIORITY_BADGE_VARIANT: Record<WorkOrderPriority, BadgeVariant> = {\n High: \"warning\",\n Low: \"default\",\n Medium: \"info\",\n Urgent: \"destructive\",\n};\n\nconst WorkOrderContent = ({ data }: { data: WorkOrderData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n checkbox: {\n borderColor: theme.colors.foreground,\n borderStyle: \"solid\",\n borderWidth: 1,\n height: 10,\n width: 10,\n },\n checkboxRow: {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 6,\n marginTop: theme.spacing.componentGap,\n },\n col: {\n flex: 1,\n paddingRight: 15,\n },\n label: {\n fontSize: 9,\n fontWeight: \"bold\",\n marginBottom: 2,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n row: {\n flexDirection: \"row\",\n },\n section: {\n marginBottom: theme.spacing.componentGap,\n },\n sectionSpaced: {\n marginBottom: theme.spacing.componentGap,\n marginTop: theme.spacing.componentGap,\n },\n signature: {\n marginBottom: 0,\n marginTop: 0,\n },\n });\n\n const partsTotal = data.parts.reduce(\n (sum, part) => sum + part.qty * part.unitPrice,\n 0\n );\n const laborTotal = data.labor.reduce(\n (sum, item) => sum + item.hours * item.rate,\n 0\n );\n const taxRate = data.taxRate ?? 0;\n const tax = (partsTotal + laborTotal) * taxRate;\n const grandTotal = partsTotal + laborTotal + tax;\n\n return (\n <Document title={`Work Order ${data.workOrderNumber}`}>\n <Page\n margin={{\n bottom: theme.spacing.page.marginBottom,\n left: theme.spacing.page.marginLeft,\n right: theme.spacing.page.marginRight,\n top: theme.spacing.page.marginTop,\n }}\n size=\"A4\"\n >\n <PageFooter\n leftText={data.warrantyInfo}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"logo-left\"\n logo={\n data.companyLogo ? (\n <PdfImage src={data.companyLogo} style={{ margin: 0 }} />\n ) : undefined\n }\n title={data.companyName}\n subtitle=\"Work Order\"\n rightText={`WO #${data.workOrderNumber}`}\n rightSubText={`Date: ${data.date}`}\n style={styles.section}\n />\n\n <Section\n noWrap\n spacing=\"none\"\n style={{\n ...styles.row,\n ...styles.section,\n alignItems: \"center\",\n justifyContent: \"space-between\",\n }}\n >\n <View\n style={{ alignItems: \"center\", flexDirection: \"row\", gap: 8 }}\n >\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\" }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Priority\n </Text>\n <Badge\n label={data.priority}\n variant={PRIORITY_BADGE_VARIANT[data.priority]}\n size=\"sm\"\n />\n </View>\n <Badge label={data.jobType} variant=\"outline\" size=\"sm\" />\n </Section>\n\n <Section\n noWrap\n spacing=\"none\"\n style={{ ...styles.row, ...styles.section }}\n >\n <View style={styles.col}>\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Customer\n </Text>\n <Text noMargin variant=\"xs\">\n {data.customer.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.customer.address}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.customer.phone}\n </Text>\n {data.customer.email ? (\n <Text noMargin variant=\"xs\">\n {data.customer.email}\n </Text>\n ) : null}\n {data.customer.accountNumber ? (\n <Text noMargin variant=\"xs\">\n {`Acct #: ${data.customer.accountNumber}`}\n </Text>\n ) : null}\n </View>\n <View style={styles.col}>\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Job Info\n </Text>\n <Text noMargin variant=\"xs\">\n {`Technician: ${data.technician}`}\n </Text>\n <Text noMargin variant=\"xs\">\n {`Job Type: ${data.jobType}`}\n </Text>\n </View>\n <View style={styles.col}>\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Equipment\n </Text>\n <Text noMargin variant=\"xs\">\n {data.equipment.description}\n </Text>\n {data.equipment.makeModel ? (\n <Text noMargin variant=\"xs\">\n {data.equipment.makeModel}\n </Text>\n ) : null}\n {data.equipment.serialNumber ? (\n <Text noMargin variant=\"xs\">\n {`S/N: ${data.equipment.serialNumber}`}\n </Text>\n ) : null}\n {data.equipment.location ? (\n <Text noMargin variant=\"xs\">\n {`Location: ${data.equipment.location}`}\n </Text>\n ) : null}\n </View>\n </Section>\n\n <Section spacing=\"none\">\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Parts Used\n </Text>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Part #</TableCell>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Unit Price</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.parts.map((part, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: parts have no stable id\n <TableRow key={index}>\n <TableCell>{part.partNumber}</TableCell>\n <TableCell>{part.description}</TableCell>\n <TableCell align=\"center\">{`${part.qty}`}</TableCell>\n <TableCell align=\"right\">{`$${part.unitPrice.toFixed(2)}`}</TableCell>\n <TableCell align=\"right\">{`$${(part.qty * part.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </Section>\n\n <Section spacing=\"none\">\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Labor\n </Text>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell>Technician</TableCell>\n <TableCell align=\"center\">Hours</TableCell>\n <TableCell align=\"right\">Rate</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.labor.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: labor entries have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell>{item.technician}</TableCell>\n <TableCell align=\"center\">{`${item.hours}`}</TableCell>\n <TableCell align=\"right\">{`$${item.rate.toFixed(2)}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.hours * item.rate).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </Section>\n\n <Section\n noWrap\n spacing=\"none\"\n style={{ ...styles.row, ...styles.section }}\n >\n <View style={{ flex: 1, paddingRight: 15 }}>\n {data.technicianNotes ? (\n <View>\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Technician Notes\n </Text>\n <Text noMargin variant=\"xs\">\n {data.technicianNotes}\n </Text>\n </View>\n ) : null}\n </View>\n <View style={{ marginLeft: \"auto\", width: 200 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n { key: \"Parts Total\", value: `$${partsTotal.toFixed(2)}` },\n { key: \"Labor Total\", value: `$${laborTotal.toFixed(2)}` },\n {\n key: `Tax (${(taxRate * 100).toFixed(2)}%)`,\n value: `$${tax.toFixed(2)}`,\n },\n {\n key: \"Grand Total\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${grandTotal.toFixed(2)}`,\n valueStyle: { fontSize: 12, fontWeight: \"bold\" },\n },\n ]}\n divided\n />\n </View>\n </Section>\n\n {data.customerNotes ? (\n <Section spacing=\"none\" style={styles.sectionSpaced}>\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Customer Notes\n </Text>\n <Text noMargin variant=\"xs\">\n {data.customerNotes}\n </Text>\n </Section>\n ) : null}\n\n <Section spacing=\"none\">\n <PdfSignatureBlock\n variant=\"double\"\n signers={[\n { date: data.date, label: \"Customer Signature\" },\n {\n date: data.date,\n label: \"Technician Signature\",\n name: data.technician,\n },\n ]}\n style={styles.signature}\n />\n <View style={styles.checkboxRow}>\n <View style={styles.checkbox} />\n <Text noMargin variant=\"xs\">\n Customer approves work performed and charges above\n </Text>\n </View>\n </Section>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const WorkOrderDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: WorkOrderData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <WorkOrderContent data={data} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/work-order/work-order.tsx"
},
@@ -34,4 +34,4 @@
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/registry.json b/apps/web/public/r/registry.json
index 6c82c17..5d00c71 100644
--- a/apps/web/public/r/registry.json
+++ b/apps/web/public/r/registry.json
@@ -700,6 +700,7 @@
"registryDependencies": [
"@pdfcn/takumi/utils",
"@pdfcn/takumi/page-footer",
+ "@pdfcn/takumi/pdf-image",
"@pdfcn/takumi/section",
"@pdfcn/takumi/text"
],
@@ -819,6 +820,7 @@
"@pdfcn/takumi/key-value",
"@pdfcn/takumi/page-footer",
"@pdfcn/takumi/page-header",
+ "@pdfcn/takumi/page-number",
"@pdfcn/takumi/graph",
"@pdfcn/takumi/list",
"@pdfcn/takumi/section",
@@ -855,6 +857,7 @@
"@pdfcn/takumi/key-value",
"@pdfcn/takumi/page-footer",
"@pdfcn/takumi/page-header",
+ "@pdfcn/takumi/page-number",
"@pdfcn/takumi/graph",
"@pdfcn/takumi/list",
"@pdfcn/takumi/section",
@@ -891,6 +894,7 @@
"@pdfcn/takumi/key-value",
"@pdfcn/takumi/page-footer",
"@pdfcn/takumi/page-header",
+ "@pdfcn/takumi/page-number",
"@pdfcn/takumi/graph",
"@pdfcn/takumi/list",
"@pdfcn/takumi/section",
@@ -927,6 +931,7 @@
"@pdfcn/takumi/key-value",
"@pdfcn/takumi/page-footer",
"@pdfcn/takumi/page-header",
+ "@pdfcn/takumi/page-number",
"@pdfcn/takumi/graph",
"@pdfcn/takumi/list",
"@pdfcn/takumi/section",
@@ -2177,6 +2182,7 @@
"@pdfcn/forme/key-value",
"@pdfcn/forme/page-footer",
"@pdfcn/forme/page-header",
+ "@pdfcn/forme/page-number",
"@pdfcn/forme/graph",
"@pdfcn/forme/list",
"@pdfcn/forme/section",
@@ -2213,6 +2219,7 @@
"@pdfcn/forme/key-value",
"@pdfcn/forme/page-footer",
"@pdfcn/forme/page-header",
+ "@pdfcn/forme/page-number",
"@pdfcn/forme/graph",
"@pdfcn/forme/list",
"@pdfcn/forme/section",
@@ -2249,6 +2256,7 @@
"@pdfcn/forme/key-value",
"@pdfcn/forme/page-footer",
"@pdfcn/forme/page-header",
+ "@pdfcn/forme/page-number",
"@pdfcn/forme/graph",
"@pdfcn/forme/list",
"@pdfcn/forme/section",
@@ -2285,6 +2293,7 @@
"@pdfcn/forme/key-value",
"@pdfcn/forme/page-footer",
"@pdfcn/forme/page-header",
+ "@pdfcn/forme/page-number",
"@pdfcn/forme/graph",
"@pdfcn/forme/list",
"@pdfcn/forme/section",
diff --git a/apps/web/public/r/takumi/alert.json b/apps/web/public/r/takumi/alert.json
index ef9ccdc..a9e63c5 100644
--- a/apps/web/public/r/takumi/alert.json
+++ b/apps/web/public/r/takumi/alert.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/takumi/components/alert/alert.tsx",
- "content": "import type { ReactNode } from \"react\";\r\n\r\nimport {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n Text as PDFText,\r\n StyleSheet,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport { Circle, Line, Path, Svg } from \"@/registry/bases/takumi/lib/pdf-svg\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type AlertVariant = \"info\" | \"success\" | \"warning\" | \"error\";\r\n\r\n/**\r\n * Alert box with severity variants for info, success, warning, and error states.\r\n * Props - `variant` | `title` | `children` | `showIcon` | `showBorder` | `style`\r\n * @see {@link PdfAlertProps}\r\n */\r\nexport interface PdfAlertProps extends Omit<PDFComponentProps, \"children\"> {\r\n /**\r\n * @default 'info'\r\n */\r\n variant?: AlertVariant;\r\n title?: string;\r\n children?: ReactNode;\r\n /**\r\n * @default true\r\n */\r\n showIcon?: boolean;\r\n /**\r\n * @default true\r\n */\r\n showBorder?: boolean;\r\n}\r\n\r\n/** Stroke width for all alert SVG icons (SVG user units). */\r\nconst ICON_STROKE_WIDTH = 1.5;\r\n\r\nconst SvgWrap = ({ children }: { children: ReactNode }) => (\r\n <Svg width={16} height={16} viewBox=\"0 0 16 16\">\r\n {children}\r\n </Svg>\r\n);\r\n\r\nconst ICON_MAP = {\r\n error: ({ color }: { color: string }) => (\r\n <SvgWrap>\r\n <Circle\r\n cx={8}\r\n cy={8}\r\n r={7}\r\n fill=\"none\"\r\n stroke={color}\r\n strokeWidth={ICON_STROKE_WIDTH}\r\n />\r\n <Line\r\n x1={5.5}\r\n y1={5.5}\r\n x2={10.5}\r\n y2={10.5}\r\n stroke={color}\r\n strokeWidth={ICON_STROKE_WIDTH}\r\n strokeLinecap=\"round\"\r\n />\r\n <Line\r\n x1={10.5}\r\n y1={5.5}\r\n x2={5.5}\r\n y2={10.5}\r\n stroke={color}\r\n strokeWidth={ICON_STROKE_WIDTH}\r\n strokeLinecap=\"round\"\r\n />\r\n </SvgWrap>\r\n ),\r\n info: ({ color }: { color: string }) => (\r\n <SvgWrap>\r\n <Circle\r\n cx={8}\r\n cy={8}\r\n r={7}\r\n fill=\"none\"\r\n stroke={color}\r\n strokeWidth={ICON_STROKE_WIDTH}\r\n />\r\n <Circle cx={8} cy={4.5} r={1} fill={color} />\r\n <Line\r\n x1={8}\r\n y1={7}\r\n x2={8}\r\n y2={11.5}\r\n stroke={color}\r\n strokeWidth={ICON_STROKE_WIDTH}\r\n strokeLinecap=\"round\"\r\n />\r\n </SvgWrap>\r\n ),\r\n success: ({ color }: { color: string }) => (\r\n <SvgWrap>\r\n <Circle\r\n cx={8}\r\n cy={8}\r\n r={7}\r\n fill=\"none\"\r\n stroke={color}\r\n strokeWidth={ICON_STROKE_WIDTH}\r\n />\r\n <Path\r\n d=\"M5 8 L7 10 L11 6\"\r\n fill=\"none\"\r\n stroke={color}\r\n strokeWidth={ICON_STROKE_WIDTH}\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n />\r\n </SvgWrap>\r\n ),\r\n warning: ({ color }: { color: string }) => (\r\n <SvgWrap>\r\n <Path\r\n d=\"M8 1.5 L15 14.5 L1 14.5 Z\"\r\n fill=\"none\"\r\n stroke={color}\r\n strokeWidth={ICON_STROKE_WIDTH}\r\n strokeLinejoin=\"round\"\r\n />\r\n <Line\r\n x1={8}\r\n y1={6}\r\n x2={8}\r\n y2={10}\r\n stroke={color}\r\n strokeWidth={ICON_STROKE_WIDTH}\r\n strokeLinecap=\"round\"\r\n />\r\n <Circle cx={8} cy={12.5} r={0.75} fill={color} />\r\n </SvgWrap>\r\n ),\r\n};\r\n\r\nconst AlertIcon = ({\r\n variant,\r\n color,\r\n}: {\r\n variant: AlertVariant;\r\n color: string;\r\n}) => {\r\n const Icon = ICON_MAP[variant];\r\n return <Icon color={color} />;\r\n};\r\n\r\nconst borderLeft = (color: string) => ({\r\n borderLeftColor: color,\r\n borderLeftWidth: 4,\r\n});\r\n\r\nconst createAlertStyles = (theme: PdfcnTheme) => {\r\n const { typography, colors, primitives } = theme;\r\n\r\n const variantColors = {\r\n error: colors.destructive ?? \"#EF4444\",\r\n info: colors.info ?? \"#3B82F6\",\r\n success: colors.success ?? \"#22C55E\",\r\n warning: colors.warning ?? \"#F59E0B\",\r\n } satisfies Record<AlertVariant, string>;\r\n\r\n const sheet = StyleSheet.create({\r\n bg: {\r\n backgroundColor: colors.muted,\r\n },\r\n borderError: borderLeft(variantColors.error),\r\n borderInfo: borderLeft(variantColors.info),\r\n borderSuccess: borderLeft(variantColors.success),\r\n borderWarning: borderLeft(variantColors.warning),\r\n container: {\r\n borderRadius: 4,\r\n flexDirection: \"row\",\r\n marginBottom: theme.spacing.componentGap,\r\n padding: 12,\r\n },\r\n contentContainer: { flex: 1 },\r\n description: {\r\n color: colors.mutedForeground,\r\n fontFamily: typography.body.fontFamily,\r\n fontSize: primitives.typography.sm,\r\n lineHeight: typography.body.lineHeight,\r\n },\r\n iconContainer: {\r\n alignItems: \"center\",\r\n justifyContent: \"flex-start\",\r\n marginRight: 10,\r\n paddingTop: 2,\r\n width: 20,\r\n },\r\n title: {\r\n color: colors.foreground,\r\n fontFamily: typography.heading.fontFamily,\r\n fontSize: primitives.typography.sm,\r\n fontWeight: primitives.fontWeights.semibold,\r\n marginBottom: 4,\r\n },\r\n });\r\n\r\n return {\r\n ...sheet,\r\n borderMap: {\r\n error: sheet.borderError,\r\n info: sheet.borderInfo,\r\n success: sheet.borderSuccess,\r\n warning: sheet.borderWarning,\r\n } as Record<AlertVariant, Style>,\r\n /** Resolved hex colors for each variant — used to tint the SVG icons. */\r\n variantColors,\r\n };\r\n};\r\n\r\nexport const PdfAlert = ({\r\n variant = \"info\",\r\n title,\r\n children,\r\n showIcon = true,\r\n showBorder = true,\r\n style,\r\n}: PdfAlertProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createAlertStyles(theme), [theme]);\r\n\r\n if (!title && !children) {\r\n return null;\r\n }\r\n\r\n const containerStyles: Style[] = [\r\n styles.container,\r\n styles.bg,\r\n ...(showBorder ? [styles.borderMap[variant]] : []),\r\n ...(style ? [style].flat() : []),\r\n ];\r\n\r\n return (\r\n <View\r\n style={[{ breakInside: \"avoid\" as const }, containerStyles]\r\n .flat()\r\n .filter(Boolean)}\r\n >\r\n {showIcon && (\r\n <View style={styles.iconContainer}>\r\n <AlertIcon variant={variant} color={styles.variantColors[variant]} />\r\n </View>\r\n )}\r\n <View style={styles.contentContainer}>\r\n {title && <PDFText style={styles.title}>{title}</PDFText>}\r\n {typeof children === \"string\" ? (\r\n <PDFText style={styles.description}>{children}</PDFText>\r\n ) : (\r\n children\r\n )}\r\n </View>\r\n </View>\r\n );\r\n};\r\n",
+ "content": "import type { ReactNode } from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { Circle, Line, Path, Svg } from \"@/lib/pdf-svg\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type AlertVariant = \"info\" | \"success\" | \"warning\" | \"error\";\n\n/**\n * Alert box with severity variants for info, success, warning, and error states.\n * Props - `variant` | `title` | `children` | `showIcon` | `showBorder` | `style`\n * @see {@link PdfAlertProps}\n */\nexport interface PdfAlertProps extends Omit<PDFComponentProps, \"children\"> {\n /**\n * @default 'info'\n */\n variant?: AlertVariant;\n title?: string;\n children?: ReactNode;\n /**\n * @default true\n */\n showIcon?: boolean;\n /**\n * @default true\n */\n showBorder?: boolean;\n}\n\n/** Stroke width for all alert SVG icons (SVG user units). */\nconst ICON_STROKE_WIDTH = 1.5;\n\nconst SvgWrap = ({ children }: { children: ReactNode }) => (\n <Svg width={16} height={16} viewBox=\"0 0 16 16\">\n {children}\n </Svg>\n);\n\nconst ICON_MAP = {\n error: ({ color }: { color: string }) => (\n <SvgWrap>\n <Circle\n cx={8}\n cy={8}\n r={7}\n fill=\"none\"\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n />\n <Line\n x1={5.5}\n y1={5.5}\n x2={10.5}\n y2={10.5}\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinecap=\"round\"\n />\n <Line\n x1={10.5}\n y1={5.5}\n x2={5.5}\n y2={10.5}\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinecap=\"round\"\n />\n </SvgWrap>\n ),\n info: ({ color }: { color: string }) => (\n <SvgWrap>\n <Circle\n cx={8}\n cy={8}\n r={7}\n fill=\"none\"\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n />\n <Circle cx={8} cy={4.5} r={1} fill={color} />\n <Line\n x1={8}\n y1={7}\n x2={8}\n y2={11.5}\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinecap=\"round\"\n />\n </SvgWrap>\n ),\n success: ({ color }: { color: string }) => (\n <SvgWrap>\n <Circle\n cx={8}\n cy={8}\n r={7}\n fill=\"none\"\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n />\n <Path\n d=\"M5 8 L7 10 L11 6\"\n fill=\"none\"\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </SvgWrap>\n ),\n warning: ({ color }: { color: string }) => (\n <SvgWrap>\n <Path\n d=\"M8 1.5 L15 14.5 L1 14.5 Z\"\n fill=\"none\"\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinejoin=\"round\"\n />\n <Line\n x1={8}\n y1={6}\n x2={8}\n y2={10}\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinecap=\"round\"\n />\n <Circle cx={8} cy={12.5} r={0.75} fill={color} />\n </SvgWrap>\n ),\n};\n\nconst AlertIcon = ({\n variant,\n color,\n}: {\n variant: AlertVariant;\n color: string;\n}) => {\n const Icon = ICON_MAP[variant];\n return <Icon color={color} />;\n};\n\nconst borderLeft = (color: string) => ({\n borderLeftColor: color,\n borderLeftWidth: 4,\n});\n\nconst createAlertStyles = (theme: PdfcnTheme) => {\n const { typography, colors, primitives } = theme;\n\n const variantColors = {\n error: colors.destructive ?? \"#EF4444\",\n info: colors.info ?? \"#3B82F6\",\n success: colors.success ?? \"#22C55E\",\n warning: colors.warning ?? \"#F59E0B\",\n } satisfies Record<AlertVariant, string>;\n\n const sheet = StyleSheet.create({\n bg: {\n backgroundColor: colors.muted,\n },\n borderError: borderLeft(variantColors.error),\n borderInfo: borderLeft(variantColors.info),\n borderSuccess: borderLeft(variantColors.success),\n borderWarning: borderLeft(variantColors.warning),\n container: {\n borderRadius: 4,\n flexDirection: \"row\",\n marginBottom: theme.spacing.componentGap,\n padding: 12,\n },\n contentContainer: { flex: 1 },\n description: {\n color: colors.mutedForeground,\n fontFamily: typography.body.fontFamily,\n fontSize: primitives.typography.sm,\n lineHeight: typography.body.lineHeight,\n },\n iconContainer: {\n alignItems: \"center\",\n justifyContent: \"flex-start\",\n marginRight: 10,\n paddingTop: 2,\n width: 20,\n },\n title: {\n color: colors.foreground,\n fontFamily: typography.heading.fontFamily,\n fontSize: primitives.typography.sm,\n fontWeight: primitives.fontWeights.semibold,\n marginBottom: 4,\n },\n });\n\n return {\n ...sheet,\n borderMap: {\n error: sheet.borderError,\n info: sheet.borderInfo,\n success: sheet.borderSuccess,\n warning: sheet.borderWarning,\n } as Record<AlertVariant, Style>,\n /** Resolved hex colors for each variant — used to tint the SVG icons. */\n variantColors,\n };\n};\n\nexport const PdfAlert = ({\n variant = \"info\",\n title,\n children,\n showIcon = true,\n showBorder = true,\n style,\n}: PdfAlertProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createAlertStyles(theme), [theme]);\n\n if (!title && !children) {\n return null;\n }\n\n const containerStyles: Style[] = [\n styles.container,\n styles.bg,\n ...(showBorder ? [styles.borderMap[variant]] : []),\n ...(style ? [style].flat() : []),\n ];\n\n return (\n <View\n style={[{ breakInside: \"avoid\" as const }, containerStyles]\n .flat()\n .filter(Boolean)}\n >\n {showIcon && (\n <View style={styles.iconContainer}>\n <AlertIcon variant={variant} color={styles.variantColors[variant]} />\n </View>\n )}\n <View style={styles.contentContainer}>\n {title && <PDFText style={styles.title}>{title}</PDFText>}\n {typeof children === \"string\" ? (\n <PDFText style={styles.description}>{children}</PDFText>\n ) : (\n children\n )}\n </View>\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/alert/alert.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/badge.json b/apps/web/public/r/takumi/badge.json
index 485af4e..660baed 100644
--- a/apps/web/public/r/takumi/badge.json
+++ b/apps/web/public/r/takumi/badge.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/takumi/components/badge/badge.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n Text as PDFText,\r\n StyleSheet,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type BadgeVariant =\r\n | \"default\"\r\n | \"primary\"\r\n | \"success\"\r\n | \"warning\"\r\n | \"destructive\"\r\n | \"info\"\r\n | \"outline\";\r\nexport type BadgeSize = \"sm\" | \"md\" | \"lg\";\r\n\r\n/**\r\n * Inline label for status, tags, or categories.\r\n *\r\n * Accepts text via either `label` prop or `children` (string). `label` takes\r\n * precedence when both are provided. The children pattern (`<Badge>text</Badge>`)\r\n * is supported for compatibility with common React idioms, but note that\r\n * `Takumi primitives` doesn't support JSX children the way HTML does — only\r\n * string children are accepted.\r\n *\r\n * Props - `label` | `children` | `variant` | `size` | `background` | `color` | `style`\r\n * @see {@link BadgeProps}\r\n */\r\nexport interface BadgeProps extends Omit<PDFComponentProps, \"children\"> {\r\n /** Text to display. Takes precedence over children when both are provided. */\r\n label?: string;\r\n /** String children as an alternative to the label prop. */\r\n children?: string;\r\n /**\r\n * @default 'default'\r\n */\r\n variant?: BadgeVariant;\r\n /**\r\n * @default 'md'\r\n */\r\n size?: BadgeSize;\r\n background?: string;\r\n color?: string;\r\n}\r\n\r\nconst createBadgeStyles = (t: PdfcnTheme) => {\r\n const { spacing, borderRadius, fontWeights } = t.primitives;\r\n const c = t.colors;\r\n const textBase = {\r\n fontFamily: t.typography.body.fontFamily,\r\n fontWeight: fontWeights.semibold,\r\n letterSpacing: 0.3,\r\n };\r\n const variantBox = (borderColor: string, bgColor: string = c.muted) => ({\r\n backgroundColor: bgColor,\r\n borderColor,\r\n borderStyle: \"solid\" as const,\r\n borderWidth: spacing[0.5],\r\n });\r\n const sheet = StyleSheet.create({\r\n containerBase: {\r\n alignItems: \"center\" as const,\r\n alignSelf: \"flex-start\" as const,\r\n borderRadius: borderRadius.full,\r\n flexDirection: \"row\" as const,\r\n },\r\n sizeLg: { paddingHorizontal: spacing[4], paddingVertical: spacing[2] },\r\n sizeMd: { paddingHorizontal: spacing[3], paddingVertical: spacing[1] },\r\n sizeSm: { paddingHorizontal: spacing[2], paddingVertical: spacing[0.5] },\r\n textDefault: { ...textBase, color: c.mutedForeground },\r\n textDestructive: { ...textBase, color: c.destructive },\r\n textInfo: { ...textBase, color: c.info },\r\n textLg: { fontSize: t.primitives.typography.sm },\r\n textMd: { fontSize: t.primitives.typography.xs },\r\n textOutline: { ...textBase, color: c.foreground },\r\n textPrimary: { ...textBase, color: c.primaryForeground },\r\n textSm: { fontSize: t.primitives.typography.xs - 1 },\r\n textSuccess: { ...textBase, color: c.success },\r\n textWarning: { ...textBase, color: c.warning },\r\n variantDefault: variantBox(c.border),\r\n variantDestructive: variantBox(c.destructive),\r\n variantInfo: variantBox(c.info),\r\n variantOutline: variantBox(c.border, c.background),\r\n variantPrimary: variantBox(c.primary, c.primary),\r\n variantSuccess: variantBox(c.success),\r\n variantWarning: variantBox(c.warning),\r\n });\r\n return {\r\n ...sheet,\r\n containerSizeMap: {\r\n lg: sheet.sizeLg,\r\n md: sheet.sizeMd,\r\n sm: sheet.sizeSm,\r\n } as Record<BadgeSize, Style>,\r\n containerVariantMap: {\r\n default: sheet.variantDefault,\r\n destructive: sheet.variantDestructive,\r\n info: sheet.variantInfo,\r\n outline: sheet.variantOutline,\r\n primary: sheet.variantPrimary,\r\n success: sheet.variantSuccess,\r\n warning: sheet.variantWarning,\r\n } as Record<BadgeVariant, Style>,\r\n textSizeMap: {\r\n lg: sheet.textLg,\r\n md: sheet.textMd,\r\n sm: sheet.textSm,\r\n } as Record<BadgeSize, Style>,\r\n textVariantMap: {\r\n default: sheet.textDefault,\r\n destructive: sheet.textDestructive,\r\n info: sheet.textInfo,\r\n outline: sheet.textOutline,\r\n primary: sheet.textPrimary,\r\n success: sheet.textSuccess,\r\n warning: sheet.textWarning,\r\n } as Record<BadgeVariant, Style>,\r\n };\r\n};\r\n\r\nexport const Badge = ({\r\n label,\r\n children,\r\n variant = \"default\",\r\n size = \"md\",\r\n background,\r\n color,\r\n style,\r\n}: BadgeProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createBadgeStyles(theme), [theme]);\r\n // `label` takes precedence; fall back to string children for React idiom compatibility\r\n const text = label ?? children ?? \"\";\r\n const containerStyles: Style[] = [\r\n styles.containerBase,\r\n styles.containerVariantMap[variant],\r\n styles.containerSizeMap[size],\r\n ...(background\r\n ? [{ backgroundColor: resolveColor(background, theme.colors) }]\r\n : []),\r\n ...(style ? [style].flat() : []),\r\n ];\r\n const textStyles: Style[] = [\r\n styles.textVariantMap[variant],\r\n styles.textSizeMap[size],\r\n ...(color ? [{ color: resolveColor(color, theme.colors) }] : []),\r\n ];\r\n return (\r\n <View style={containerStyles}>\r\n <PDFText style={textStyles}>{text}</PDFText>\r\n </View>\r\n );\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type BadgeVariant =\n | \"default\"\n | \"primary\"\n | \"success\"\n | \"warning\"\n | \"destructive\"\n | \"info\"\n | \"outline\";\nexport type BadgeSize = \"sm\" | \"md\" | \"lg\";\n\n/**\n * Inline label for status, tags, or categories.\n *\n * Accepts text via either `label` prop or `children` (string). `label` takes\n * precedence when both are provided. The children pattern (`<Badge>text</Badge>`)\n * is supported for compatibility with common React idioms, but note that\n * `Takumi primitives` doesn't support JSX children the way HTML does — only\n * string children are accepted.\n *\n * Props - `label` | `children` | `variant` | `size` | `background` | `color` | `style`\n * @see {@link BadgeProps}\n */\nexport interface BadgeProps extends Omit<PDFComponentProps, \"children\"> {\n /** Text to display. Takes precedence over children when both are provided. */\n label?: string;\n /** String children as an alternative to the label prop. */\n children?: string;\n /**\n * @default 'default'\n */\n variant?: BadgeVariant;\n /**\n * @default 'md'\n */\n size?: BadgeSize;\n background?: string;\n color?: string;\n}\n\nconst createBadgeStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius, fontWeights } = t.primitives;\n const c = t.colors;\n const textBase = {\n fontFamily: t.typography.body.fontFamily,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.3,\n };\n const variantBox = (borderColor: string, bgColor: string = c.muted) => ({\n backgroundColor: bgColor,\n borderColor,\n borderStyle: \"solid\" as const,\n borderWidth: spacing[0.5],\n });\n const sheet = StyleSheet.create({\n containerBase: {\n alignItems: \"center\" as const,\n alignSelf: \"flex-start\" as const,\n borderRadius: borderRadius.full,\n flexDirection: \"row\" as const,\n },\n sizeLg: { paddingHorizontal: spacing[4], paddingVertical: spacing[2] },\n sizeMd: { paddingHorizontal: spacing[3], paddingVertical: spacing[1] },\n sizeSm: { paddingHorizontal: spacing[2], paddingVertical: spacing[0.5] },\n textDefault: { ...textBase, color: c.mutedForeground },\n textDestructive: { ...textBase, color: c.destructive },\n textInfo: { ...textBase, color: c.info },\n textLg: { fontSize: t.primitives.typography.sm },\n textMd: { fontSize: t.primitives.typography.xs },\n textOutline: { ...textBase, color: c.foreground },\n textPrimary: { ...textBase, color: c.primaryForeground },\n textSm: { fontSize: t.primitives.typography.xs - 1 },\n textSuccess: { ...textBase, color: c.success },\n textWarning: { ...textBase, color: c.warning },\n variantDefault: variantBox(c.border),\n variantDestructive: variantBox(c.destructive),\n variantInfo: variantBox(c.info),\n variantOutline: variantBox(c.border, c.background),\n variantPrimary: variantBox(c.primary, c.primary),\n variantSuccess: variantBox(c.success),\n variantWarning: variantBox(c.warning),\n });\n return {\n ...sheet,\n containerSizeMap: {\n lg: sheet.sizeLg,\n md: sheet.sizeMd,\n sm: sheet.sizeSm,\n } as Record<BadgeSize, Style>,\n containerVariantMap: {\n default: sheet.variantDefault,\n destructive: sheet.variantDestructive,\n info: sheet.variantInfo,\n outline: sheet.variantOutline,\n primary: sheet.variantPrimary,\n success: sheet.variantSuccess,\n warning: sheet.variantWarning,\n } as Record<BadgeVariant, Style>,\n textSizeMap: {\n lg: sheet.textLg,\n md: sheet.textMd,\n sm: sheet.textSm,\n } as Record<BadgeSize, Style>,\n textVariantMap: {\n default: sheet.textDefault,\n destructive: sheet.textDestructive,\n info: sheet.textInfo,\n outline: sheet.textOutline,\n primary: sheet.textPrimary,\n success: sheet.textSuccess,\n warning: sheet.textWarning,\n } as Record<BadgeVariant, Style>,\n };\n};\n\nexport const Badge = ({\n label,\n children,\n variant = \"default\",\n size = \"md\",\n background,\n color,\n style,\n}: BadgeProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createBadgeStyles(theme), [theme]);\n // `label` takes precedence; fall back to string children for React idiom compatibility\n const text = label ?? children ?? \"\";\n const containerStyles: Style[] = [\n styles.containerBase,\n styles.containerVariantMap[variant],\n styles.containerSizeMap[size],\n ...(background\n ? [{ backgroundColor: resolveColor(background, theme.colors) }]\n : []),\n ...(style ? [style].flat() : []),\n ];\n const textStyles: Style[] = [\n styles.textVariantMap[variant],\n styles.textSizeMap[size],\n ...(color ? [{ color: resolveColor(color, theme.colors) }] : []),\n ];\n return (\n <View style={containerStyles}>\n <PDFText style={textStyles}>{text}</PDFText>\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/badge/badge.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/card.json b/apps/web/public/r/takumi/card.json
index e2b880a..34b250a 100644
--- a/apps/web/public/r/takumi/card.json
+++ b/apps/web/public/r/takumi/card.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/takumi/components/card/card.tsx",
- "content": "import type { ReactNode } from \"react\";\r\n\r\nimport {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n Text as PDFText,\r\n StyleSheet,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type CardVariant = \"default\" | \"bordered\" | \"muted\";\r\n\r\n/**\r\n * Bordered content card with optional title and padding presets.\r\n * Props - `title` | `children` | `variant` | `padding` | `wrap` | `style`\r\n * @see {@link PdfCardProps}\r\n */\r\nexport interface PdfCardProps extends Omit<PDFComponentProps, \"children\"> {\r\n title?: string;\r\n children?: ReactNode;\r\n /**\r\n * @default 'default'\r\n */\r\n variant?: CardVariant;\r\n /**\r\n * @default 'md'\r\n */\r\n padding?: \"sm\" | \"md\" | \"lg\";\r\n /**\r\n * When false, the card will not split across PDF pages.\r\n * @default false\r\n */\r\n wrap?: boolean;\r\n}\r\n\r\nconst createCardStyles = (t: PdfcnTheme) => {\r\n const { spacing, borderRadius, fontWeights } = t.primitives;\r\n return StyleSheet.create({\r\n body: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n lineHeight: t.typography.body.lineHeight,\r\n },\r\n card: {\r\n backgroundColor: t.colors.background,\r\n borderColor: t.colors.border,\r\n borderRadius: borderRadius.sm,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n marginBottom: t.spacing.componentGap,\r\n },\r\n cardBordered: { borderWidth: 2 },\r\n cardMuted: { backgroundColor: t.colors.muted },\r\n paddingLg: { padding: spacing[4] },\r\n paddingMd: { padding: spacing[3] },\r\n paddingSm: { padding: spacing[2] },\r\n title: {\r\n borderBottomColor: t.colors.border,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: 1,\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.heading.fontFamily,\r\n fontSize: t.primitives.typography.base,\r\n fontWeight: fontWeights.semibold,\r\n lineHeight: t.typography.heading.lineHeight,\r\n marginBottom: spacing[2],\r\n paddingBottom: spacing[1] + 2,\r\n },\r\n });\r\n};\r\n\r\nexport const PdfCard = ({\r\n title,\r\n children,\r\n variant = \"default\",\r\n padding = \"md\",\r\n wrap = false,\r\n style,\r\n}: PdfCardProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createCardStyles(theme), [theme]);\r\n const paddingMap = {\r\n lg: styles.paddingLg,\r\n md: styles.paddingMd,\r\n sm: styles.paddingSm,\r\n };\r\n const cardStyles: Style[] = [styles.card];\r\n if (variant === \"bordered\") {\r\n cardStyles.push(styles.cardBordered);\r\n }\r\n if (variant === \"muted\") {\r\n cardStyles.push(styles.cardMuted);\r\n }\r\n cardStyles.push(paddingMap[padding]);\r\n if (style) {\r\n cardStyles.push(style);\r\n }\r\n return (\r\n <View wrap={wrap} style={cardStyles}>\r\n {title ? <PDFText style={styles.title}>{title}</PDFText> : null}\r\n {typeof children === \"string\" ? (\r\n <PDFText style={styles.body}>{children}</PDFText>\r\n ) : (\r\n children\r\n )}\r\n </View>\r\n );\r\n};\r\n",
+ "content": "import type { ReactNode } from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type CardVariant = \"default\" | \"bordered\" | \"muted\";\n\n/**\n * Bordered content card with optional title and padding presets.\n * Props - `title` | `children` | `variant` | `padding` | `wrap` | `style`\n * @see {@link PdfCardProps}\n */\nexport interface PdfCardProps extends Omit<PDFComponentProps, \"children\"> {\n title?: string;\n children?: ReactNode;\n /**\n * @default 'default'\n */\n variant?: CardVariant;\n /**\n * @default 'md'\n */\n padding?: \"sm\" | \"md\" | \"lg\";\n /**\n * When false, the card will not split across PDF pages.\n * @default false\n */\n wrap?: boolean;\n}\n\nconst createCardStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius, fontWeights } = t.primitives;\n return StyleSheet.create({\n body: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n lineHeight: t.typography.body.lineHeight,\n },\n card: {\n backgroundColor: t.colors.background,\n borderColor: t.colors.border,\n borderRadius: borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: 1,\n marginBottom: t.spacing.componentGap,\n },\n cardBordered: { borderWidth: 2 },\n cardMuted: { backgroundColor: t.colors.muted },\n paddingLg: { padding: spacing[4] },\n paddingMd: { padding: spacing[3] },\n paddingSm: { padding: spacing[2] },\n title: {\n borderBottomColor: t.colors.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n color: t.colors.foreground,\n fontFamily: t.typography.heading.fontFamily,\n fontSize: t.primitives.typography.base,\n fontWeight: fontWeights.semibold,\n lineHeight: t.typography.heading.lineHeight,\n marginBottom: spacing[2],\n paddingBottom: spacing[1] + 2,\n },\n });\n};\n\nexport const PdfCard = ({\n title,\n children,\n variant = \"default\",\n padding = \"md\",\n wrap = false,\n style,\n}: PdfCardProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createCardStyles(theme), [theme]);\n const paddingMap = {\n lg: styles.paddingLg,\n md: styles.paddingMd,\n sm: styles.paddingSm,\n };\n const cardStyles: Style[] = [styles.card];\n if (variant === \"bordered\") {\n cardStyles.push(styles.cardBordered);\n }\n if (variant === \"muted\") {\n cardStyles.push(styles.cardMuted);\n }\n cardStyles.push(paddingMap[padding]);\n if (style) {\n cardStyles.push(style);\n }\n return (\n <View wrap={wrap} style={cardStyles}>\n {title ? <PDFText style={styles.title}>{title}</PDFText> : null}\n {typeof children === \"string\" ? (\n <PDFText style={styles.body}>{children}</PDFText>\n ) : (\n children\n )}\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/card/card.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/data-table.json b/apps/web/public/r/takumi/data-table.json
index 3242ef9..6533bf7 100644
--- a/apps/web/public/r/takumi/data-table.json
+++ b/apps/web/public/r/takumi/data-table.json
@@ -14,22 +14,22 @@
"files": [
{
"path": "registry/bases/takumi/components/data-table/data-table.styles.ts",
- "content": "import { StyleSheet } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\n/**\r\n * Creates compact-mode cell and text styles for the DataTable component.\r\n * Used when `size=\"compact\"` to render denser rows with smaller font sizes.\r\n * @param t - The resolved PdfcnTheme instance.\r\n */\r\nexport const createCompactStyles = (t: PdfcnTheme) => {\r\n const { spacing, fontWeights, lineHeights } = t.primitives;\r\n return StyleSheet.create({\r\n cell: {\r\n paddingHorizontal: spacing[2],\r\n paddingVertical: spacing[0.5],\r\n },\r\n footerText: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n fontWeight: fontWeights.semibold,\r\n lineHeight: lineHeights.normal,\r\n },\r\n headerText: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n fontWeight: fontWeights.semibold,\r\n lineHeight: lineHeights.normal,\r\n },\r\n text: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n lineHeight: lineHeights.normal,\r\n },\r\n });\r\n};\r\n\r\n/**\r\n * Converts an arbitrary cell value to a display string.\r\n * Returns an empty string for null/undefined values.\r\n * @param value - The raw cell value to format.\r\n */\r\nexport const formatValue = (value: unknown): string => {\r\n if (value === null || value === undefined) {\r\n return \"\";\r\n }\r\n if (typeof value === \"number\") {\r\n return String(value);\r\n }\r\n return String(value);\r\n};\r\n",
+ "content": "import { StyleSheet } from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\n/**\n * Creates compact-mode cell and text styles for the DataTable component.\n * Used when `size=\"compact\"` to render denser rows with smaller font sizes.\n * @param t - The resolved PdfcnTheme instance.\n */\nexport const createCompactStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights, lineHeights } = t.primitives;\n return StyleSheet.create({\n cell: {\n paddingHorizontal: spacing[2],\n paddingVertical: spacing[0.5],\n },\n footerText: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n fontWeight: fontWeights.semibold,\n lineHeight: lineHeights.normal,\n },\n headerText: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n fontWeight: fontWeights.semibold,\n lineHeight: lineHeights.normal,\n },\n text: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n lineHeight: lineHeights.normal,\n },\n });\n};\n\n/**\n * Converts an arbitrary cell value to a display string.\n * Returns an empty string for null/undefined values.\n * @param value - The raw cell value to format.\n */\nexport const formatValue = (value: unknown): string => {\n if (value === null || value === undefined) {\n return \"\";\n }\n if (typeof value === \"number\") {\n return String(value);\n }\n return String(value);\n};\n",
"type": "registry:component",
"target": "components/pdf/data-table/data-table.styles.ts"
},
{
"path": "registry/bases/takumi/components/data-table/data-table.tsx",
- "content": "import { Fragment } from \"react\";\r\n\r\nimport {\r\n Table,\r\n TableBody,\r\n TableCell,\r\n TableFooter,\r\n TableHeader,\r\n TableRow,\r\n} from \"@/registry/bases/takumi/components/table/table\";\r\nimport {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport { Text as PDFText } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\n\r\nimport { createCompactStyles, formatValue } from \"./data-table.styles\";\r\nimport type { DataTableProps } from \"./data-table.types\";\r\n\r\nexport const DataTable = <T extends Record<string, unknown>>({\r\n columns,\r\n data,\r\n variant = \"grid\",\r\n footer,\r\n stripe = false,\r\n size = \"default\",\r\n noWrap = false,\r\n style,\r\n}: DataTableProps<T>) => {\r\n const theme = usePdfcnTheme();\r\n const compact = useSafeMemo(() => createCompactStyles(theme), [theme]);\r\n const isCompact = size === \"compact\";\r\n\r\n return (\r\n <Table variant={variant} zebraStripe={stripe} noWrap={noWrap} style={style}>\r\n <TableHeader>\r\n <TableRow header>\r\n {columns.map((col) => (\r\n <TableCell\r\n key={col.key}\r\n header\r\n align={col.align ?? \"left\"}\r\n width={col.width}\r\n style={isCompact ? compact.cell : undefined}\r\n >\r\n {isCompact ? (\r\n <PDFText\r\n style={[\r\n compact.headerText,\r\n col.align ? ({ textAlign: col.align } as Style) : {},\r\n ]}\r\n >\r\n {col.header}\r\n </PDFText>\r\n ) : (\r\n col.header\r\n )}\r\n </TableCell>\r\n ))}\r\n </TableRow>\r\n </TableHeader>\r\n <TableBody>\r\n {data.map((row, i) => (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: DataTable has no row id; order is stable for static data\r\n <Fragment key={i}>\r\n <TableRow>\r\n {columns.map((col) => {\r\n const value = row[col.key];\r\n const rendered = col.render ? col.render(value, row) : null;\r\n const text = rendered === null ? formatValue(value) : null;\r\n return (\r\n <TableCell\r\n key={col.key}\r\n align={col.align ?? \"left\"}\r\n width={col.width}\r\n style={isCompact ? compact.cell : undefined}\r\n >\r\n {isCompact\r\n ? (rendered ?? (\r\n <PDFText\r\n style={[\r\n compact.text,\r\n col.align\r\n ? ({ textAlign: col.align } as Style)\r\n : {},\r\n ]}\r\n >\r\n {text}\r\n </PDFText>\r\n ))\r\n : (rendered ?? text)}\r\n </TableCell>\r\n );\r\n })}\r\n </TableRow>\r\n </Fragment>\r\n ))}\r\n </TableBody>\r\n {footer && (\r\n <TableFooter>\r\n <TableRow footer>\r\n {columns.map((col) => {\r\n const value = col.key in footer ? footer[col.key] : \"\";\r\n const rendered = col.renderFooter\r\n ? col.renderFooter(value)\r\n : null;\r\n const text = rendered === null ? formatValue(value) : null;\r\n return (\r\n <TableCell\r\n key={col.key}\r\n footer={!!value}\r\n align={col.align ?? \"left\"}\r\n width={col.width}\r\n style={isCompact ? compact.cell : undefined}\r\n >\r\n {isCompact\r\n ? (rendered ?? (\r\n <PDFText\r\n style={[\r\n value ? compact.footerText : compact.text,\r\n col.align\r\n ? ({ textAlign: col.align } as Style)\r\n : {},\r\n ]}\r\n >\r\n {text}\r\n </PDFText>\r\n ))\r\n : (rendered ?? text)}\r\n </TableCell>\r\n );\r\n })}\r\n </TableRow>\r\n </TableFooter>\r\n )}\r\n </Table>\r\n );\r\n};\r\n",
+ "content": "import { Fragment } from \"react\";\n\nimport {\n Table,\n TableBody,\n TableCell,\n TableFooter,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport { Text as PDFText } from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\n\nimport { createCompactStyles, formatValue } from \"./data-table.styles\";\nimport type { DataTableProps } from \"./data-table.types\";\n\nexport const DataTable = <T extends Record<string, unknown>>({\n columns,\n data,\n variant = \"grid\",\n footer,\n stripe = false,\n size = \"default\",\n noWrap = false,\n style,\n}: DataTableProps<T>) => {\n const theme = usePdfcnTheme();\n const compact = useSafeMemo(() => createCompactStyles(theme), [theme]);\n const isCompact = size === \"compact\";\n\n return (\n <Table variant={variant} zebraStripe={stripe} noWrap={noWrap} style={style}>\n <TableHeader>\n <TableRow header>\n {columns.map((col) => (\n <TableCell\n key={col.key}\n header\n align={col.align ?? \"left\"}\n width={col.width}\n style={isCompact ? compact.cell : undefined}\n >\n {isCompact ? (\n <PDFText\n style={[\n compact.headerText,\n col.align ? ({ textAlign: col.align } as Style) : {},\n ]}\n >\n {col.header}\n </PDFText>\n ) : (\n col.header\n )}\n </TableCell>\n ))}\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.map((row, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: DataTable has no row id; order is stable for static data\n <Fragment key={i}>\n <TableRow>\n {columns.map((col) => {\n const value = row[col.key];\n const rendered = col.render ? col.render(value, row) : null;\n const text = rendered === null ? formatValue(value) : null;\n return (\n <TableCell\n key={col.key}\n align={col.align ?? \"left\"}\n width={col.width}\n style={isCompact ? compact.cell : undefined}\n >\n {isCompact\n ? (rendered ?? (\n <PDFText\n style={[\n compact.text,\n col.align\n ? ({ textAlign: col.align } as Style)\n : {},\n ]}\n >\n {text}\n </PDFText>\n ))\n : (rendered ?? text)}\n </TableCell>\n );\n })}\n </TableRow>\n </Fragment>\n ))}\n </TableBody>\n {footer && (\n <TableFooter>\n <TableRow footer>\n {columns.map((col) => {\n const value = col.key in footer ? footer[col.key] : \"\";\n const rendered = col.renderFooter\n ? col.renderFooter(value)\n : null;\n const text = rendered === null ? formatValue(value) : null;\n return (\n <TableCell\n key={col.key}\n footer={!!value}\n align={col.align ?? \"left\"}\n width={col.width}\n style={isCompact ? compact.cell : undefined}\n >\n {isCompact\n ? (rendered ?? (\n <PDFText\n style={[\n value ? compact.footerText : compact.text,\n col.align\n ? ({ textAlign: col.align } as Style)\n : {},\n ]}\n >\n {text}\n </PDFText>\n ))\n : (rendered ?? text)}\n </TableCell>\n );\n })}\n </TableRow>\n </TableFooter>\n )}\n </Table>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/data-table/data-table.tsx"
},
{
"path": "registry/bases/takumi/components/data-table/data-table.types.ts",
- "content": "import type React from \"react\";\r\n\r\nimport type { TableVariant } from \"@/registry/bases/takumi/components/table/table.types\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\n\r\n/** DataTable row density size. */\r\nexport type DataTableSize = \"default\" | \"compact\";\r\n\r\n/**\r\n * Column definition for a DataTable.\r\n * Props - `key` | `header` | `align` | `width` | `render` | `renderFooter`\r\n * @see {@link DataTableColumn}\r\n */\r\nexport interface DataTableColumn<T = Record<string, unknown>> {\r\n key: keyof T & string;\r\n header: string;\r\n align?: \"left\" | \"center\" | \"right\";\r\n width?: string | number;\r\n /**\r\n * Custom cell renderer. Must return Takumi primitives elements (Text, View,\r\n * Image, etc.) — NOT HTML DOM elements. TypeScript accepts ReactNode but DOM\r\n * nodes will crash at runtime in the PDF renderer.\r\n */\r\n render?: (value: unknown, row: T) => React.ReactNode;\r\n /**\r\n * Custom footer cell renderer. Same constraint: return Takumi primitives\r\n * elements only — no HTML/DOM nodes.\r\n */\r\n renderFooter?: (value: unknown) => React.ReactNode;\r\n}\r\n\r\n/**\r\n * Data table for PDF rendering with column definitions, footer support, and stripe options.\r\n * Props - `columns` | `data` | `variant` | `footer` | `stripe` | `size` | `noWrap` | `style`\r\n * @see {@link DataTableProps}\r\n */\r\nexport interface DataTableProps<T = Record<string, unknown>> extends Omit<\r\n PDFComponentProps,\r\n \"children\"\r\n> {\r\n columns: DataTableColumn<T>[];\r\n data: T[];\r\n /**\r\n * @default 'grid'\r\n */\r\n variant?: TableVariant;\r\n footer?: Partial<Record<keyof T & string, string | number>>;\r\n stripe?: boolean;\r\n /**\r\n * @default 'default'\r\n */\r\n size?: DataTableSize;\r\n noWrap?: boolean;\r\n}\r\n",
+ "content": "import type React from \"react\";\n\nimport type { TableVariant } from \"@/components/pdf/table/table.types\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\n\n/** DataTable row density size. */\nexport type DataTableSize = \"default\" | \"compact\";\n\n/**\n * Column definition for a DataTable.\n * Props - `key` | `header` | `align` | `width` | `render` | `renderFooter`\n * @see {@link DataTableColumn}\n */\nexport interface DataTableColumn<T = Record<string, unknown>> {\n key: keyof T & string;\n header: string;\n align?: \"left\" | \"center\" | \"right\";\n width?: string | number;\n /**\n * Custom cell renderer. Must return Takumi primitives elements (Text, View,\n * Image, etc.) — NOT HTML DOM elements. TypeScript accepts ReactNode but DOM\n * nodes will crash at runtime in the PDF renderer.\n */\n render?: (value: unknown, row: T) => React.ReactNode;\n /**\n * Custom footer cell renderer. Same constraint: return Takumi primitives\n * elements only — no HTML/DOM nodes.\n */\n renderFooter?: (value: unknown) => React.ReactNode;\n}\n\n/**\n * Data table for PDF rendering with column definitions, footer support, and stripe options.\n * Props - `columns` | `data` | `variant` | `footer` | `stripe` | `size` | `noWrap` | `style`\n * @see {@link DataTableProps}\n */\nexport interface DataTableProps<T = Record<string, unknown>> extends Omit<\n PDFComponentProps,\n \"children\"\n> {\n columns: DataTableColumn<T>[];\n data: T[];\n /**\n * @default 'grid'\n */\n variant?: TableVariant;\n footer?: Partial<Record<keyof T & string, string | number>>;\n stripe?: boolean;\n /**\n * @default 'default'\n */\n size?: DataTableSize;\n noWrap?: boolean;\n}\n",
"type": "registry:component",
"target": "components/pdf/data-table/data-table.types.ts"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/divider.json b/apps/web/public/r/takumi/divider.json
index e795d5b..365c0c2 100644
--- a/apps/web/public/r/takumi/divider.json
+++ b/apps/web/public/r/takumi/divider.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/takumi/components/divider/divider.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n Text as PDFText,\r\n StyleSheet,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type DividerVariant = \"solid\" | \"dashed\" | \"dotted\";\r\nexport type DividerThickness = \"thin\" | \"medium\" | \"thick\";\r\nexport type DividerSpacing = \"none\" | \"sm\" | \"md\" | \"lg\";\r\n\r\n/**\r\n * Horizontal rule with optional label, style variants, and spacing presets.\r\n * Props - `spacing` | `variant` | `color` | `thickness` | `label` | `width` | `style`\r\n * @see {@link DividerProps}\r\n */\r\nexport interface DividerProps extends Omit<PDFComponentProps, \"children\"> {\r\n /**\r\n * @default 'md'\r\n */\r\n spacing?: DividerSpacing;\r\n /**\r\n * @default 'solid'\r\n */\r\n variant?: DividerVariant;\r\n color?: string;\r\n /**\r\n * @default 'thin'\r\n */\r\n thickness?: DividerThickness;\r\n label?: string;\r\n width?: string | number;\r\n}\r\n\r\nconst createDividerStyles = (t: PdfcnTheme) => {\r\n const { spacing, fontWeights } = t.primitives;\r\n return StyleSheet.create({\r\n base: { borderBottomColor: t.colors.border, borderBottomStyle: \"solid\" },\r\n dashed: { borderBottomStyle: \"dashed\" },\r\n dotted: { borderBottomStyle: \"dotted\" },\r\n labelContainer: { alignItems: \"center\", flexDirection: \"row\" },\r\n labelLine: {\r\n borderBottomColor: t.colors.border,\r\n borderBottomStyle: \"solid\",\r\n flex: 1,\r\n },\r\n labelText: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n fontWeight: fontWeights.medium,\r\n letterSpacing: t.primitives.letterSpacing.wider * 10,\r\n paddingHorizontal: spacing[3],\r\n textTransform: \"uppercase\",\r\n },\r\n medium: { borderBottomWidth: spacing[1] },\r\n solid: { borderBottomStyle: \"solid\" },\r\n spacingLg: { marginVertical: t.spacing.sectionGap },\r\n spacingMd: { marginVertical: t.spacing.componentGap },\r\n spacingNone: { marginVertical: spacing[0] },\r\n spacingSm: { marginVertical: t.spacing.paragraphGap },\r\n thick: { borderBottomWidth: spacing[2] },\r\n thin: { borderBottomWidth: spacing[0.5] },\r\n });\r\n};\r\n\r\nexport const Divider = ({\r\n spacing = \"md\",\r\n variant = \"solid\",\r\n color,\r\n thickness = \"thin\",\r\n label,\r\n width,\r\n style,\r\n}: DividerProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createDividerStyles(theme), [theme]);\r\n const spacingMap = {\r\n lg: styles.spacingLg,\r\n md: styles.spacingMd,\r\n none: styles.spacingNone,\r\n sm: styles.spacingSm,\r\n };\r\n const variantMap = {\r\n dashed: styles.dashed,\r\n dotted: styles.dotted,\r\n solid: styles.solid,\r\n };\r\n const thicknessMap = {\r\n medium: styles.medium,\r\n thick: styles.thick,\r\n thin: styles.thin,\r\n };\r\n\r\n if (label) {\r\n const lineStyle: Style[] = [\r\n styles.labelLine,\r\n thicknessMap[thickness],\r\n variantMap[variant],\r\n ];\r\n if (color) {\r\n lineStyle.push({ borderBottomColor: resolveColor(color, theme.colors) });\r\n }\r\n const containerStyles: Style[] = [\r\n styles.labelContainer,\r\n spacingMap[spacing],\r\n ];\r\n if (width !== undefined) {\r\n containerStyles.push({ width } as Style);\r\n }\r\n if (style) {\r\n containerStyles.push(...[style].flat());\r\n }\r\n const labelTextStyle: Style[] = [styles.labelText];\r\n if (color) {\r\n labelTextStyle.push({ color: resolveColor(color, theme.colors) });\r\n }\r\n return (\r\n <View style={containerStyles}>\r\n <View style={lineStyle} />\r\n <PDFText style={labelTextStyle}>{label}</PDFText>\r\n <View style={lineStyle} />\r\n </View>\r\n );\r\n }\r\n\r\n const styleArray: Style[] = [\r\n styles.base,\r\n spacingMap[spacing],\r\n variantMap[variant],\r\n thicknessMap[thickness],\r\n ];\r\n if (color) {\r\n styleArray.push({ borderBottomColor: resolveColor(color, theme.colors) });\r\n }\r\n if (width !== undefined) {\r\n styleArray.push({ width } as Style);\r\n }\r\n if (style) {\r\n styleArray.push(...[style].flat());\r\n }\r\n return <View style={styleArray} />;\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type DividerVariant = \"solid\" | \"dashed\" | \"dotted\";\nexport type DividerThickness = \"thin\" | \"medium\" | \"thick\";\nexport type DividerSpacing = \"none\" | \"sm\" | \"md\" | \"lg\";\n\n/**\n * Horizontal rule with optional label, style variants, and spacing presets.\n * Props - `spacing` | `variant` | `color` | `thickness` | `label` | `width` | `style`\n * @see {@link DividerProps}\n */\nexport interface DividerProps extends Omit<PDFComponentProps, \"children\"> {\n /**\n * @default 'md'\n */\n spacing?: DividerSpacing;\n /**\n * @default 'solid'\n */\n variant?: DividerVariant;\n color?: string;\n /**\n * @default 'thin'\n */\n thickness?: DividerThickness;\n label?: string;\n width?: string | number;\n}\n\nconst createDividerStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights } = t.primitives;\n return StyleSheet.create({\n base: { borderBottomColor: t.colors.border, borderBottomStyle: \"solid\" },\n dashed: { borderBottomStyle: \"dashed\" },\n dotted: { borderBottomStyle: \"dotted\" },\n labelContainer: { alignItems: \"center\", flexDirection: \"row\" },\n labelLine: {\n borderBottomColor: t.colors.border,\n borderBottomStyle: \"solid\",\n flex: 1,\n },\n labelText: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n fontWeight: fontWeights.medium,\n letterSpacing: t.primitives.letterSpacing.wider * 10,\n paddingHorizontal: spacing[3],\n textTransform: \"uppercase\",\n },\n medium: { borderBottomWidth: spacing[1] },\n solid: { borderBottomStyle: \"solid\" },\n spacingLg: { marginVertical: t.spacing.sectionGap },\n spacingMd: { marginVertical: t.spacing.componentGap },\n spacingNone: { marginVertical: spacing[0] },\n spacingSm: { marginVertical: t.spacing.paragraphGap },\n thick: { borderBottomWidth: spacing[2] },\n thin: { borderBottomWidth: spacing[0.5] },\n });\n};\n\nexport const Divider = ({\n spacing = \"md\",\n variant = \"solid\",\n color,\n thickness = \"thin\",\n label,\n width,\n style,\n}: DividerProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createDividerStyles(theme), [theme]);\n const spacingMap = {\n lg: styles.spacingLg,\n md: styles.spacingMd,\n none: styles.spacingNone,\n sm: styles.spacingSm,\n };\n const variantMap = {\n dashed: styles.dashed,\n dotted: styles.dotted,\n solid: styles.solid,\n };\n const thicknessMap = {\n medium: styles.medium,\n thick: styles.thick,\n thin: styles.thin,\n };\n\n if (label) {\n const lineStyle: Style[] = [\n styles.labelLine,\n thicknessMap[thickness],\n variantMap[variant],\n ];\n if (color) {\n lineStyle.push({ borderBottomColor: resolveColor(color, theme.colors) });\n }\n const containerStyles: Style[] = [\n styles.labelContainer,\n spacingMap[spacing],\n ];\n if (width !== undefined) {\n containerStyles.push({ width } as Style);\n }\n if (style) {\n containerStyles.push(...[style].flat());\n }\n const labelTextStyle: Style[] = [styles.labelText];\n if (color) {\n labelTextStyle.push({ color: resolveColor(color, theme.colors) });\n }\n return (\n <View style={containerStyles}>\n <View style={lineStyle} />\n <PDFText style={labelTextStyle}>{label}</PDFText>\n <View style={lineStyle} />\n </View>\n );\n }\n\n const styleArray: Style[] = [\n styles.base,\n spacingMap[spacing],\n variantMap[variant],\n thicknessMap[thickness],\n ];\n if (color) {\n styleArray.push({ borderBottomColor: resolveColor(color, theme.colors) });\n }\n if (width !== undefined) {\n styleArray.push({ width } as Style);\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return <View style={styleArray} />;\n};\n",
"type": "registry:component",
"target": "components/pdf/divider/divider.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/event-agenda.json b/apps/web/public/r/takumi/event-agenda.json
index 931dad9..d6b5296 100644
--- a/apps/web/public/r/takumi/event-agenda.json
+++ b/apps/web/public/r/takumi/event-agenda.json
@@ -17,7 +17,7 @@
"files": [
{
"path": "registry/bases/takumi/blocks/event-agenda/event-agenda.tsx",
- "content": "import { Section } from \"@/registry/bases/takumi/components/section/section\";\nimport { Text } from \"@/registry/bases/takumi/components/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n Document,\n Page,\n StyleSheet,\n View,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type { EventAgendaProps, Session } from \"./event-agenda.types\";\nimport { sampleEventAgendaData } from \"./event-agenda.types\";\n\ninterface TimeSlotGroup {\n sessions: Session[];\n time: string;\n}\n\nconst groupSessionsByTime = (sessions: Session[]): TimeSlotGroup[] => {\n const groups: TimeSlotGroup[] = [];\n const map = new Map<string, Session[]>();\n\n for (const session of sessions) {\n const existing = map.get(session.time);\n if (existing) {\n existing.push(session);\n } else {\n const list = [session];\n map.set(session.time, list);\n groups.push({ sessions: list, time: session.time });\n }\n }\n\n return groups;\n};\n\nexport const EventAgendaContent = ({ data }: { data: EventAgendaProps }) => {\n const theme = usePdfcnTheme();\n const accent = data.accentColor ?? theme.colors.primary;\n\n const trackColorMap = new Map<string, string>();\n if (data.tracks) {\n for (const track of data.tracks) {\n trackColorMap.set(track.name.toLowerCase(), track.color);\n }\n }\n\n const styles = StyleSheet.create({\n breakBadge: {\n backgroundColor: theme.colors.muted,\n borderColor: theme.colors.border,\n borderRadius: 4,\n borderStyle: \"solid\",\n borderWidth: 1,\n paddingHorizontal: 6,\n paddingVertical: 2,\n },\n breakCard: {\n backgroundColor: theme.colors.muted,\n borderColor: theme.colors.border,\n borderRadius: 6,\n borderStyle: \"dashed\",\n borderWidth: 1,\n flex: 1,\n paddingHorizontal: 10,\n paddingVertical: 7,\n },\n dayBanner: {\n alignItems: \"center\",\n backgroundColor: theme.colors.muted,\n borderColor: theme.colors.border,\n borderRadius: 6,\n borderStyle: \"solid\",\n borderWidth: 1,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 10,\n marginTop: 8,\n paddingHorizontal: 12,\n paddingVertical: 6,\n },\n footerContainer: {\n borderTopColor: theme.colors.border,\n borderTopStyle: \"solid\",\n borderTopWidth: 1,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginTop: \"auto\",\n paddingTop: 8,\n },\n headerContainer: {\n borderBottomColor: theme.colors.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1.5,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: 10,\n },\n legendContainer: {\n alignItems: \"center\",\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 6,\n marginBottom: 8,\n },\n legendDot: {\n borderRadius: 3,\n height: 7,\n marginRight: 4,\n width: 7,\n },\n legendItem: {\n alignItems: \"center\",\n backgroundColor: theme.colors.muted,\n borderColor: theme.colors.border,\n borderRadius: 4,\n borderStyle: \"solid\",\n borderWidth: 1,\n flexDirection: \"row\",\n paddingHorizontal: 6,\n paddingVertical: 2,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: 32,\n position: \"relative\",\n },\n roomBadge: {\n backgroundColor: theme.colors.muted,\n borderColor: theme.colors.border,\n borderRadius: 3,\n borderStyle: \"solid\",\n borderWidth: 1,\n paddingHorizontal: 5,\n paddingVertical: 1,\n },\n sessionCard: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: 6,\n borderStyle: \"solid\",\n borderWidth: 1,\n flex: 1,\n flexDirection: \"column\",\n paddingHorizontal: 10,\n paddingVertical: 7,\n position: \"relative\",\n },\n sessionsRow: {\n flex: 1,\n flexDirection: \"row\",\n gap: 8,\n },\n timeBox: {\n alignItems: \"flex-start\",\n flexDirection: \"column\",\n paddingTop: 2,\n width: 78,\n },\n timeSlotRow: {\n flexDirection: \"row\",\n marginBottom: 8,\n },\n trackBadge: {\n borderRadius: 3,\n paddingHorizontal: 6,\n paddingVertical: 1,\n },\n });\n\n return (\n <Document title={`${data.eventName} - Agenda`}>\n {data.days.map((day, dayIndex) => {\n const timeSlots = groupSessionsByTime(day.sessions);\n\n return (\n <Page key={day.label} size=\"A4\" style={styles.page}>\n {/* Header */}\n <View style={styles.headerContainer}>\n <View style={{ flex: 1, paddingRight: 16 }}>\n <Text\n style={{\n color: accent,\n fontSize: 8.5,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n marginBottom: 2,\n textTransform: \"uppercase\",\n }}\n noMargin\n >\n Event Agenda\n </Text>\n <Text\n style={{\n fontSize: 20,\n fontWeight: \"bold\",\n lineHeight: 1.2,\n marginBottom: 4,\n }}\n noMargin\n >\n {data.eventName}\n </Text>\n <Text\n style={{ color: theme.colors.mutedForeground, fontSize: 8.5 }}\n noMargin\n >\n {data.date}\n {data.endDate ? ` – ${data.endDate}` : \"\"} • {data.venue}\n </Text>\n </View>\n\n <View\n style={{ alignItems: \"flex-end\", justifyContent: \"center\" }}\n >\n <View\n style={{\n backgroundColor: accent,\n borderRadius: 4,\n paddingHorizontal: 10,\n paddingVertical: 4,\n }}\n >\n <Text\n style={{\n color: \"#ffffff\",\n fontSize: 10,\n fontWeight: \"bold\",\n letterSpacing: 0.8,\n textTransform: \"uppercase\",\n }}\n noMargin\n >\n AGENDA\n </Text>\n </View>\n </View>\n </View>\n\n {/* Day Title Banner */}\n <View style={styles.dayBanner}>\n <View\n style={{ alignItems: \"center\", flexDirection: \"row\", gap: 6 }}\n >\n <Text style={{ fontSize: 11, fontWeight: \"bold\" }} noMargin>\n {day.label}\n </Text>\n <Text\n style={{ color: theme.colors.mutedForeground, fontSize: 9 }}\n noMargin\n >\n — {day.date}\n </Text>\n </View>\n\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 8.5,\n fontWeight: 600,\n }}\n noMargin\n >\n Day {dayIndex + 1} of {data.days.length}\n </Text>\n </View>\n\n {/* Track Legend (if available) */}\n {data.tracks && data.tracks.length > 0 && (\n <View style={styles.legendContainer}>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.5,\n fontWeight: \"bold\",\n letterSpacing: 0.5,\n marginRight: 4,\n textTransform: \"uppercase\",\n }}\n noMargin\n >\n Tracks:\n </Text>\n {data.tracks.map((track) => (\n <View key={track.name} style={styles.legendItem}>\n <View\n style={[\n styles.legendDot,\n { backgroundColor: track.color },\n ]}\n />\n <Text\n style={{ fontSize: 7.5, fontWeight: 600 }}\n noMargin\n >\n {track.name}\n </Text>\n </View>\n ))}\n </View>\n )}\n\n {/* Sessions Time Grid */}\n <Section style={{ marginTop: 2 }}>\n {timeSlots.map((slot) => {\n const isSingleBreak =\n slot.sessions.length === 1 && slot.sessions[0].isBreak;\n\n return (\n <View key={slot.time} style={styles.timeSlotRow}>\n {/* Time Column */}\n <View style={styles.timeBox}>\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 9,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n {slot.time}\n </Text>\n {slot.sessions[0].endTime && (\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.5,\n }}\n noMargin\n >\n to {slot.sessions[0].endTime}\n </Text>\n )}\n </View>\n\n {/* Content Column */}\n {isSingleBreak ? (\n <View style={styles.breakCard}>\n <View\n style={{\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n }}\n >\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 9.5,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n {slot.sessions[0].title}\n </Text>\n <View style={styles.breakBadge}>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7,\n fontWeight: \"bold\",\n letterSpacing: 0.5,\n textTransform: \"uppercase\",\n }}\n noMargin\n >\n Break\n </Text>\n </View>\n </View>\n {slot.sessions[0].description && (\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.5,\n marginTop: 2,\n }}\n noMargin\n >\n {slot.sessions[0].description}\n </Text>\n )}\n </View>\n ) : (\n <View style={styles.sessionsRow}>\n {slot.sessions.map((session, sIndex) => {\n const trackColor = session.track\n ? trackColorMap.get(session.track.toLowerCase())\n : undefined;\n\n return (\n <View\n key={`${session.title}-${sIndex}`}\n style={[\n styles.sessionCard,\n trackColor\n ? {\n borderLeftColor: trackColor,\n borderLeftWidth: 3,\n }\n : {},\n ]}\n >\n {/* Track & Room Metadata */}\n <View\n style={{\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 4,\n marginBottom: 3,\n }}\n >\n {session.track && (\n <View\n style={[\n styles.trackBadge,\n {\n backgroundColor: trackColor\n ? `${trackColor}1A`\n : theme.colors.muted,\n },\n ]}\n >\n <Text\n style={{\n color:\n trackColor ?? theme.colors.foreground,\n fontSize: 7,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n {session.track}\n </Text>\n </View>\n )}\n {session.room && (\n <View style={styles.roomBadge}>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7,\n fontWeight: 600,\n }}\n noMargin\n >\n {session.room}\n </Text>\n </View>\n )}\n </View>\n\n {/* Title */}\n <Text\n style={{\n fontSize: 9,\n fontWeight: \"bold\",\n lineHeight: 1.25,\n }}\n noMargin\n >\n {session.title}\n </Text>\n\n {/* Speaker */}\n {session.speaker && (\n <Text\n style={{\n color: accent,\n fontSize: 7.8,\n fontWeight: 600,\n marginTop: 2,\n }}\n noMargin\n >\n {session.speaker}\n </Text>\n )}\n\n {/* Description */}\n {session.description && (\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.2,\n lineHeight: 1.2,\n marginTop: 2,\n }}\n noMargin\n >\n {session.description}\n </Text>\n )}\n </View>\n );\n })}\n </View>\n )}\n </View>\n );\n })}\n </Section>\n\n {/* Footer */}\n <View style={styles.footerContainer}>\n <View style={{ flexDirection: \"column\", gap: 1 }}>\n {data.wifiInfo && (\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.5,\n fontWeight: 600,\n }}\n noMargin\n >\n Wi-Fi: {data.wifiInfo}\n </Text>\n )}\n {data.emergencyContact && (\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.2,\n }}\n noMargin\n >\n {data.emergencyContact}\n </Text>\n )}\n </View>\n\n <View style={{ alignItems: \"flex-end\" }}>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.5,\n fontWeight: 600,\n }}\n noMargin\n >\n Page {dayIndex + 1} of {data.days.length}\n </Text>\n </View>\n </View>\n </Page>\n );\n })}\n </Document>\n );\n};\n\nexport const EventAgendaDocument = ({\n theme,\n data = sampleEventAgendaData,\n}: {\n theme?: PdfcnTheme;\n data?: EventAgendaProps;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <EventAgendaContent data={data} />\n </PdfcnThemeProvider>\n);\n\nexport { EventAgendaDocument as EventAgenda };\n",
+ "content": "import { Section } from \"@/components/pdf/section/section\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Document,\n Page,\n StyleSheet,\n View,\n} from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { EventAgendaProps, Session } from \"./event-agenda.types\";\nimport { sampleEventAgendaData } from \"./event-agenda.types\";\n\ninterface TimeSlotGroup {\n sessions: Session[];\n time: string;\n}\n\nconst groupSessionsByTime = (sessions: Session[]): TimeSlotGroup[] => {\n const groups: TimeSlotGroup[] = [];\n const map = new Map<string, Session[]>();\n\n for (const session of sessions) {\n const existing = map.get(session.time);\n if (existing) {\n existing.push(session);\n } else {\n const list = [session];\n map.set(session.time, list);\n groups.push({ sessions: list, time: session.time });\n }\n }\n\n return groups;\n};\n\nexport const EventAgendaContent = ({ data }: { data: EventAgendaProps }) => {\n const theme = usePdfcnTheme();\n const accent = data.accentColor ?? theme.colors.primary;\n\n const trackColorMap = new Map<string, string>();\n if (data.tracks) {\n for (const track of data.tracks) {\n trackColorMap.set(track.name.toLowerCase(), track.color);\n }\n }\n\n const styles = StyleSheet.create({\n breakBadge: {\n backgroundColor: theme.colors.muted,\n borderColor: theme.colors.border,\n borderRadius: 4,\n borderStyle: \"solid\",\n borderWidth: 1,\n paddingHorizontal: 6,\n paddingVertical: 2,\n },\n breakCard: {\n backgroundColor: theme.colors.muted,\n borderColor: theme.colors.border,\n borderRadius: 6,\n borderStyle: \"dashed\",\n borderWidth: 1,\n flex: 1,\n paddingHorizontal: 10,\n paddingVertical: 7,\n },\n dayBanner: {\n alignItems: \"center\",\n backgroundColor: theme.colors.muted,\n borderColor: theme.colors.border,\n borderRadius: 6,\n borderStyle: \"solid\",\n borderWidth: 1,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 10,\n marginTop: 8,\n paddingHorizontal: 12,\n paddingVertical: 6,\n },\n footerContainer: {\n borderTopColor: theme.colors.border,\n borderTopStyle: \"solid\",\n borderTopWidth: 1,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginTop: \"auto\",\n paddingTop: 8,\n },\n headerContainer: {\n borderBottomColor: theme.colors.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1.5,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: 10,\n },\n legendContainer: {\n alignItems: \"center\",\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 6,\n marginBottom: 8,\n },\n legendDot: {\n borderRadius: 3,\n height: 7,\n marginRight: 4,\n width: 7,\n },\n legendItem: {\n alignItems: \"center\",\n backgroundColor: theme.colors.muted,\n borderColor: theme.colors.border,\n borderRadius: 4,\n borderStyle: \"solid\",\n borderWidth: 1,\n flexDirection: \"row\",\n paddingHorizontal: 6,\n paddingVertical: 2,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: 32,\n position: \"relative\",\n },\n roomBadge: {\n backgroundColor: theme.colors.muted,\n borderColor: theme.colors.border,\n borderRadius: 3,\n borderStyle: \"solid\",\n borderWidth: 1,\n paddingHorizontal: 5,\n paddingVertical: 1,\n },\n sessionCard: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: 6,\n borderStyle: \"solid\",\n borderWidth: 1,\n flex: 1,\n flexDirection: \"column\",\n paddingHorizontal: 10,\n paddingVertical: 7,\n position: \"relative\",\n },\n sessionsRow: {\n flex: 1,\n flexDirection: \"row\",\n gap: 8,\n },\n timeBox: {\n alignItems: \"flex-start\",\n flexDirection: \"column\",\n paddingTop: 2,\n width: 78,\n },\n timeSlotRow: {\n flexDirection: \"row\",\n marginBottom: 8,\n },\n trackBadge: {\n borderRadius: 3,\n paddingHorizontal: 6,\n paddingVertical: 1,\n },\n });\n\n return (\n <Document title={`${data.eventName} - Agenda`}>\n {data.days.map((day, dayIndex) => {\n const timeSlots = groupSessionsByTime(day.sessions);\n\n return (\n <Page key={day.label} size=\"A4\" style={styles.page}>\n {/* Header */}\n <View style={styles.headerContainer}>\n <View style={{ flex: 1, paddingRight: 16 }}>\n <Text\n style={{\n color: accent,\n fontSize: 8.5,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n marginBottom: 2,\n textTransform: \"uppercase\",\n }}\n noMargin\n >\n Event Agenda\n </Text>\n <Text\n style={{\n fontSize: 20,\n fontWeight: \"bold\",\n lineHeight: 1.2,\n marginBottom: 4,\n }}\n noMargin\n >\n {data.eventName}\n </Text>\n <Text\n style={{ color: theme.colors.mutedForeground, fontSize: 8.5 }}\n noMargin\n >\n {data.date}\n {data.endDate ? ` – ${data.endDate}` : \"\"} • {data.venue}\n </Text>\n </View>\n\n <View\n style={{ alignItems: \"flex-end\", justifyContent: \"center\" }}\n >\n <View\n style={{\n backgroundColor: accent,\n borderRadius: 4,\n paddingHorizontal: 10,\n paddingVertical: 4,\n }}\n >\n <Text\n style={{\n color: \"#ffffff\",\n fontSize: 10,\n fontWeight: \"bold\",\n letterSpacing: 0.8,\n textTransform: \"uppercase\",\n }}\n noMargin\n >\n AGENDA\n </Text>\n </View>\n </View>\n </View>\n\n {/* Day Title Banner */}\n <View style={styles.dayBanner}>\n <View\n style={{ alignItems: \"center\", flexDirection: \"row\", gap: 6 }}\n >\n <Text style={{ fontSize: 11, fontWeight: \"bold\" }} noMargin>\n {day.label}\n </Text>\n <Text\n style={{ color: theme.colors.mutedForeground, fontSize: 9 }}\n noMargin\n >\n — {day.date}\n </Text>\n </View>\n\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 8.5,\n fontWeight: 600,\n }}\n noMargin\n >\n Day {dayIndex + 1} of {data.days.length}\n </Text>\n </View>\n\n {/* Track Legend (if available) */}\n {data.tracks && data.tracks.length > 0 && (\n <View style={styles.legendContainer}>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.5,\n fontWeight: \"bold\",\n letterSpacing: 0.5,\n marginRight: 4,\n textTransform: \"uppercase\",\n }}\n noMargin\n >\n Tracks:\n </Text>\n {data.tracks.map((track) => (\n <View key={track.name} style={styles.legendItem}>\n <View\n style={[\n styles.legendDot,\n { backgroundColor: track.color },\n ]}\n />\n <Text style={{ fontSize: 7.5, fontWeight: 600 }} noMargin>\n {track.name}\n </Text>\n </View>\n ))}\n </View>\n )}\n\n {/* Sessions Time Grid */}\n <Section style={{ marginTop: 2 }}>\n {timeSlots.map((slot) => {\n const isSingleBreak =\n slot.sessions.length === 1 && slot.sessions[0].isBreak;\n\n return (\n <View key={slot.time} style={styles.timeSlotRow}>\n {/* Time Column */}\n <View style={styles.timeBox}>\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 9,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n {slot.time}\n </Text>\n {slot.sessions[0].endTime && (\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.5,\n }}\n noMargin\n >\n to {slot.sessions[0].endTime}\n </Text>\n )}\n </View>\n\n {/* Content Column */}\n {isSingleBreak ? (\n <View style={styles.breakCard}>\n <View\n style={{\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n }}\n >\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 9.5,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n {slot.sessions[0].title}\n </Text>\n <View style={styles.breakBadge}>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7,\n fontWeight: \"bold\",\n letterSpacing: 0.5,\n textTransform: \"uppercase\",\n }}\n noMargin\n >\n Break\n </Text>\n </View>\n </View>\n {slot.sessions[0].description && (\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.5,\n marginTop: 2,\n }}\n noMargin\n >\n {slot.sessions[0].description}\n </Text>\n )}\n </View>\n ) : (\n <View style={styles.sessionsRow}>\n {slot.sessions.map((session, sIndex) => {\n const trackColor = session.track\n ? trackColorMap.get(session.track.toLowerCase())\n : undefined;\n\n return (\n <View\n key={`${session.title}-${sIndex}`}\n style={[\n styles.sessionCard,\n trackColor\n ? {\n borderLeftColor: trackColor,\n borderLeftWidth: 3,\n }\n : {},\n ]}\n >\n {/* Track & Room Metadata */}\n <View\n style={{\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 4,\n marginBottom: 3,\n }}\n >\n {session.track && (\n <View\n style={[\n styles.trackBadge,\n {\n backgroundColor: trackColor\n ? `${trackColor}1A`\n : theme.colors.muted,\n },\n ]}\n >\n <Text\n style={{\n color:\n trackColor ?? theme.colors.foreground,\n fontSize: 7,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n {session.track}\n </Text>\n </View>\n )}\n {session.room && (\n <View style={styles.roomBadge}>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7,\n fontWeight: 600,\n }}\n noMargin\n >\n {session.room}\n </Text>\n </View>\n )}\n </View>\n\n {/* Title */}\n <Text\n style={{\n fontSize: 9,\n fontWeight: \"bold\",\n lineHeight: 1.25,\n }}\n noMargin\n >\n {session.title}\n </Text>\n\n {/* Speaker */}\n {session.speaker && (\n <Text\n style={{\n color: accent,\n fontSize: 7.8,\n fontWeight: 600,\n marginTop: 2,\n }}\n noMargin\n >\n {session.speaker}\n </Text>\n )}\n\n {/* Description */}\n {session.description && (\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.2,\n lineHeight: 1.2,\n marginTop: 2,\n }}\n noMargin\n >\n {session.description}\n </Text>\n )}\n </View>\n );\n })}\n </View>\n )}\n </View>\n );\n })}\n </Section>\n\n {/* Footer */}\n <View style={styles.footerContainer}>\n <View style={{ flexDirection: \"column\", gap: 1 }}>\n {data.wifiInfo && (\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.5,\n fontWeight: 600,\n }}\n noMargin\n >\n Wi-Fi: {data.wifiInfo}\n </Text>\n )}\n {data.emergencyContact && (\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.2,\n }}\n noMargin\n >\n {data.emergencyContact}\n </Text>\n )}\n </View>\n\n <View style={{ alignItems: \"flex-end\" }}>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 7.5,\n fontWeight: 600,\n }}\n noMargin\n >\n Page {dayIndex + 1} of {data.days.length}\n </Text>\n </View>\n </View>\n </Page>\n );\n })}\n </Document>\n );\n};\n\nexport const EventAgendaDocument = ({\n theme,\n data = sampleEventAgendaData,\n}: {\n theme?: PdfcnTheme;\n data?: EventAgendaProps;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <EventAgendaContent data={data} />\n </PdfcnThemeProvider>\n);\n\nexport { EventAgendaDocument as EventAgenda };\n",
"type": "registry:block",
"target": "components/pdf/blocks/event-agenda/event-agenda.tsx"
},
@@ -29,4 +29,4 @@
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/event-ticket.json b/apps/web/public/r/takumi/event-ticket.json
index 0534fa1..7be5de2 100644
--- a/apps/web/public/r/takumi/event-ticket.json
+++ b/apps/web/public/r/takumi/event-ticket.json
@@ -17,7 +17,7 @@
"files": [
{
"path": "registry/bases/takumi/blocks/event-ticket/event-ticket.tsx",
- "content": "import { PdfImage } from \"@/registry/bases/takumi/components/pdf-image/pdf-image\";\nimport { PdfQRCode } from \"@/registry/bases/takumi/components/qrcode/qrcode\";\nimport { Text } from \"@/registry/bases/takumi/components/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type { EventTicketData } from \"./event-ticket.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: EventTicketData = {\n accentColor: \"#52525b\",\n address: \"123 Main St, Las Vegas, NV\",\n doorsOpen: \"8:00 AM\",\n eventDate: \"May 15, 2026\",\n eventName: \"ShadCN Labs Conf\",\n eventTime: \"9:00 AM\",\n logoUrl: \"/favicon.png\",\n organizer: \"ShadCN Labs\",\n seat: { number: \"12\", row: \"3\", section: \"A\" },\n socialLinks: [\n { platform: \"X\", url: \"x.com/shadcn\" },\n { platform: \"Instagram\", url: \"instagram.com/shadcn\" },\n ],\n terms: \"Ticket is non-transferable. All sales final. No re-entry.\",\n ticketNumber: \"TKT-00142\",\n ticketType: \"VIP\",\n venue: \"Convention Center\",\n};\n\n// Standard event ticket, 7\" x 3.5\", expressed in PDF points (72 dpi)\nconst TICKET_SIZE = { height: 252, width: 504 };\n\nconst STUB_WIDTH = 120;\n\nconst STRIPE_WIDTH = 8;\n\nconst NOTCH_RADIUS = 8;\n\nconst hexRgb = (color: string): [number, number, number] | null => {\n const hex = color.trim().replace(/^#/, \"\");\n\n if (/^[0-9a-f]{3}$/i.test(hex)) {\n return [\n Number.parseInt(hex[0] + hex[0], 16),\n Number.parseInt(hex[1] + hex[1], 16),\n Number.parseInt(hex[2] + hex[2], 16),\n ];\n }\n\n if (/^[0-9a-f]{6}([0-9a-f]{2})?$/i.test(hex)) {\n return [\n Number.parseInt(hex.slice(0, 2), 16),\n Number.parseInt(hex.slice(2, 4), 16),\n Number.parseInt(hex.slice(4, 6), 16),\n ];\n }\n\n return null;\n};\n\nconst inkOnAccent = (accent: string, light: string, dark: string) => {\n const rgb = hexRgb(accent);\n\n if (!rgb) {\n return dark;\n }\n\n const [r, g, b] = rgb;\n const luminance = (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;\n\n return luminance > 0.55 ? dark : light;\n};\n\nconst socialHandle = (url: string) => {\n const clean = url\n .replace(/^https?:\\/\\//i, \"\")\n .replace(/^www\\./i, \"\")\n .replace(/\\/$/, \"\");\n const parts = clean.split(\"/\").filter(Boolean);\n const handle = parts.at(-1);\n\n if (parts.length > 1 && handle) {\n return handle.startsWith(\"@\") ? handle : `@${handle}`;\n }\n\n return clean;\n};\n\nconst EventTicketContent = ({ data }: { data: EventTicketData }) => {\n const theme = usePdfcnTheme();\n const paper = theme.colors.background;\n const ink = theme.colors.foreground;\n const quiet = theme.colors.mutedForeground;\n\n const accent = resolveColor(\n data.accentColor ?? theme.colors.primary,\n theme.colors\n );\n const onAccent = inkOnAccent(accent, paper, ink);\n\n const styles = StyleSheet.create({\n admit: {\n color: onAccent,\n fontSize: 7,\n fontWeight: \"bold\",\n letterSpacing: 2,\n textTransform: \"uppercase\",\n },\n body: {\n flex: 1,\n justifyContent: \"space-between\",\n paddingBottom: 16,\n paddingLeft: 20,\n paddingRight: 18,\n paddingTop: 18,\n },\n brand: {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 8,\n marginBottom: 14,\n },\n fact: {\n flexShrink: 1,\n minWidth: 0,\n paddingRight: 12,\n },\n facts: {\n flexDirection: \"row\",\n },\n footer: {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 12,\n marginTop: 10,\n },\n label: {\n color: quiet,\n fontSize: 7,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n marginBottom: 3,\n textTransform: \"uppercase\",\n },\n logo: { borderRadius: 3, height: 14, width: 14 },\n notch: {\n backgroundColor: paper,\n borderRadius: NOTCH_RADIUS,\n height: NOTCH_RADIUS * 2,\n left: TICKET_SIZE.width - STUB_WIDTH - NOTCH_RADIUS,\n position: \"absolute\",\n width: NOTCH_RADIUS * 2,\n },\n organizer: {\n color: quiet,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 1.1,\n textTransform: \"uppercase\",\n },\n page: {\n backgroundColor: paper,\n boxSizing: \"border-box\",\n flexDirection: \"row\",\n height: TICKET_SIZE.height,\n overflow: \"hidden\",\n position: \"relative\",\n width: TICKET_SIZE.width,\n },\n pill: {\n backgroundColor: accent,\n borderRadius: 9,\n marginLeft: \"auto\",\n paddingHorizontal: 8,\n paddingVertical: 3,\n },\n pillText: {\n color: onAccent,\n fontSize: 7,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n textTransform: \"uppercase\",\n },\n qr: {\n backgroundColor: \"#ffffff\",\n borderRadius: 6,\n padding: 5,\n },\n serial: {\n color: onAccent,\n fontSize: 7,\n fontWeight: \"bold\",\n letterSpacing: 1.1,\n textTransform: \"uppercase\",\n },\n socialItem: {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 4,\n },\n socialLabel: {\n color: quiet,\n fontSize: 6.5,\n fontWeight: \"bold\",\n letterSpacing: 0.4,\n textTransform: \"uppercase\",\n },\n socialList: {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 8,\n },\n socialValue: {\n color: quiet,\n fontSize: 6.5,\n },\n stripe: {\n backgroundColor: accent,\n width: STRIPE_WIDTH,\n },\n stub: {\n alignItems: \"center\",\n backgroundColor: accent,\n borderLeftColor: paper,\n borderLeftStyle: \"dashed\",\n borderLeftWidth: 1.5,\n justifyContent: \"space-between\",\n paddingBottom: 14,\n paddingHorizontal: 12,\n paddingTop: 16,\n width: STUB_WIDTH,\n },\n terms: {\n color: quiet,\n flex: 1,\n fontSize: 6.5,\n lineHeight: 1.4,\n paddingRight: 8,\n },\n title: {\n color: ink,\n fontSize: 26,\n fontWeight: \"bold\",\n letterSpacing: -0.6,\n lineHeight: 1.08,\n marginBottom: 8,\n },\n value: {\n color: ink,\n fontSize: 12,\n fontWeight: \"bold\",\n },\n venue: {\n color: quiet,\n fontSize: 10,\n lineHeight: 1.4,\n },\n });\n\n return (\n <Document title={`${data.eventName} ${data.ticketNumber}`}>\n <Page size={TICKET_SIZE} style={styles.page}>\n <View style={styles.stripe} />\n\n <View style={styles.body}>\n <View>\n <View style={styles.brand}>\n {data.logoUrl && (\n <PdfImage\n fit=\"contain\"\n src={data.logoUrl}\n style={styles.logo}\n />\n )}\n <Text noMargin style={styles.organizer}>\n {data.organizer ?? \"Event ticket\"}\n </Text>\n <View style={styles.pill}>\n <Text noMargin style={styles.pillText}>\n {data.ticketType}\n </Text>\n </View>\n </View>\n <Text noMargin style={styles.title}>\n {data.eventName}\n </Text>\n <Text noMargin style={styles.venue}>\n {data.venue}\n </Text>\n <Text noMargin style={styles.venue}>\n {data.address}\n </Text>\n </View>\n\n <View>\n <View style={styles.facts}>\n <View style={styles.fact}>\n <Text noMargin style={styles.label}>\n Date\n </Text>\n <Text noMargin style={styles.value}>\n {data.eventDate}\n </Text>\n </View>\n <View style={styles.fact}>\n <Text noMargin style={styles.label}>\n Time\n </Text>\n <Text noMargin style={styles.value}>\n {data.eventTime}\n </Text>\n </View>\n {data.doorsOpen && (\n <View style={styles.fact}>\n <Text noMargin style={styles.label}>\n Doors\n </Text>\n <Text noMargin style={styles.value}>\n {data.doorsOpen}\n </Text>\n </View>\n )}\n {data.seat && (\n <View style={styles.fact}>\n <Text noMargin style={styles.label}>\n Seat\n </Text>\n <Text noMargin style={styles.value}>\n {`${data.seat.section}–${data.seat.row}–${data.seat.number}`}\n </Text>\n </View>\n )}\n </View>\n {(data.terms ||\n (data.socialLinks && data.socialLinks.length > 0)) && (\n <View style={styles.footer}>\n {data.terms && (\n <Text noMargin style={styles.terms}>\n {data.terms}\n </Text>\n )}\n {data.socialLinks && data.socialLinks.length > 0 && (\n <View style={styles.socialList}>\n {data.socialLinks.map((link) => (\n <View\n key={`${link.platform}-${link.url}`}\n style={styles.socialItem}\n >\n <Text noMargin style={styles.socialLabel}>\n {link.platform}\n </Text>\n <Text noMargin style={styles.socialValue}>\n {socialHandle(link.url)}\n </Text>\n </View>\n ))}\n </View>\n )}\n </View>\n )}\n </View>\n </View>\n\n <View style={styles.stub}>\n <Text noMargin style={styles.admit}>\n Admit one\n </Text>\n <View style={styles.qr}>\n {data.qrCodeUrl ? (\n <PdfImage\n fit=\"contain\"\n height={68}\n src={data.qrCodeUrl}\n width={68}\n />\n ) : (\n <PdfQRCode\n backgroundColor=\"#ffffff\"\n color=\"#000000\"\n size={68}\n value={data.ticketNumber}\n />\n )}\n </View>\n <Text noMargin style={styles.serial}>\n {data.ticketNumber}\n </Text>\n </View>\n\n <View style={[styles.notch, { top: -NOTCH_RADIUS }]} />\n <View style={[styles.notch, { bottom: -NOTCH_RADIUS }]} />\n </Page>\n </Document>\n );\n};\n\nexport const EventTicketDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: EventTicketData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <EventTicketContent data={data} />\n </PdfcnThemeProvider>\n);\n",
+ "content": "import { PdfImage } from \"@/components/pdf/pdf-image/pdf-image\";\nimport { PdfQRCode } from \"@/components/pdf/qrcode/qrcode\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { EventTicketData } from \"./event-ticket.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: EventTicketData = {\n accentColor: \"#52525b\",\n address: \"123 Main St, Las Vegas, NV\",\n doorsOpen: \"8:00 AM\",\n eventDate: \"May 15, 2026\",\n eventName: \"ShadCN Labs Conf\",\n eventTime: \"9:00 AM\",\n logoUrl: \"/favicon.png\",\n organizer: \"ShadCN Labs\",\n seat: { number: \"12\", row: \"3\", section: \"A\" },\n socialLinks: [\n { platform: \"X\", url: \"x.com/shadcn\" },\n { platform: \"Instagram\", url: \"instagram.com/shadcn\" },\n ],\n terms: \"Ticket is non-transferable. All sales final. No re-entry.\",\n ticketNumber: \"TKT-00142\",\n ticketType: \"VIP\",\n venue: \"Convention Center\",\n};\n\n// Standard event ticket, 7\" x 3.5\", expressed in PDF points (72 dpi)\nconst TICKET_SIZE = { height: 252, width: 504 };\n\nconst STUB_WIDTH = 120;\n\nconst STRIPE_WIDTH = 8;\n\nconst NOTCH_RADIUS = 8;\n\nconst hexRgb = (color: string): [number, number, number] | null => {\n const hex = color.trim().replace(/^#/, \"\");\n\n if (/^[0-9a-f]{3}$/i.test(hex)) {\n return [\n Number.parseInt(hex[0] + hex[0], 16),\n Number.parseInt(hex[1] + hex[1], 16),\n Number.parseInt(hex[2] + hex[2], 16),\n ];\n }\n\n if (/^[0-9a-f]{6}([0-9a-f]{2})?$/i.test(hex)) {\n return [\n Number.parseInt(hex.slice(0, 2), 16),\n Number.parseInt(hex.slice(2, 4), 16),\n Number.parseInt(hex.slice(4, 6), 16),\n ];\n }\n\n return null;\n};\n\nconst inkOnAccent = (accent: string, light: string, dark: string) => {\n const rgb = hexRgb(accent);\n\n if (!rgb) {\n return dark;\n }\n\n const [r, g, b] = rgb;\n const luminance = (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;\n\n return luminance > 0.55 ? dark : light;\n};\n\nconst socialHandle = (url: string) => {\n const clean = url\n .replace(/^https?:\\/\\//i, \"\")\n .replace(/^www\\./i, \"\")\n .replace(/\\/$/, \"\");\n const parts = clean.split(\"/\").filter(Boolean);\n const handle = parts.at(-1);\n\n if (parts.length > 1 && handle) {\n return handle.startsWith(\"@\") ? handle : `@${handle}`;\n }\n\n return clean;\n};\n\nconst EventTicketContent = ({ data }: { data: EventTicketData }) => {\n const theme = usePdfcnTheme();\n const paper = theme.colors.background;\n const ink = theme.colors.foreground;\n const quiet = theme.colors.mutedForeground;\n\n const accent = resolveColor(\n data.accentColor ?? theme.colors.primary,\n theme.colors\n );\n const onAccent = inkOnAccent(accent, paper, ink);\n\n const styles = StyleSheet.create({\n admit: {\n color: onAccent,\n fontSize: 7,\n fontWeight: \"bold\",\n letterSpacing: 2,\n textTransform: \"uppercase\",\n },\n body: {\n flex: 1,\n justifyContent: \"space-between\",\n paddingBottom: 16,\n paddingLeft: 20,\n paddingRight: 18,\n paddingTop: 18,\n },\n brand: {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 8,\n marginBottom: 14,\n },\n fact: {\n flexShrink: 1,\n minWidth: 0,\n paddingRight: 12,\n },\n facts: {\n flexDirection: \"row\",\n },\n footer: {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 12,\n marginTop: 10,\n },\n label: {\n color: quiet,\n fontSize: 7,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n marginBottom: 3,\n textTransform: \"uppercase\",\n },\n logo: { borderRadius: 3, height: 14, width: 14 },\n notch: {\n backgroundColor: paper,\n borderRadius: NOTCH_RADIUS,\n height: NOTCH_RADIUS * 2,\n left: TICKET_SIZE.width - STUB_WIDTH - NOTCH_RADIUS,\n position: \"absolute\",\n width: NOTCH_RADIUS * 2,\n },\n organizer: {\n color: quiet,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 1.1,\n textTransform: \"uppercase\",\n },\n page: {\n backgroundColor: paper,\n boxSizing: \"border-box\",\n flexDirection: \"row\",\n height: TICKET_SIZE.height,\n overflow: \"hidden\",\n position: \"relative\",\n width: TICKET_SIZE.width,\n },\n pill: {\n backgroundColor: accent,\n borderRadius: 9,\n marginLeft: \"auto\",\n paddingHorizontal: 8,\n paddingVertical: 3,\n },\n pillText: {\n color: onAccent,\n fontSize: 7,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n textTransform: \"uppercase\",\n },\n qr: {\n backgroundColor: \"#ffffff\",\n borderRadius: 6,\n padding: 5,\n },\n serial: {\n color: onAccent,\n fontSize: 7,\n fontWeight: \"bold\",\n letterSpacing: 1.1,\n textTransform: \"uppercase\",\n },\n socialItem: {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 4,\n },\n socialLabel: {\n color: quiet,\n fontSize: 6.5,\n fontWeight: \"bold\",\n letterSpacing: 0.4,\n textTransform: \"uppercase\",\n },\n socialList: {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 8,\n },\n socialValue: {\n color: quiet,\n fontSize: 6.5,\n },\n stripe: {\n backgroundColor: accent,\n width: STRIPE_WIDTH,\n },\n stub: {\n alignItems: \"center\",\n backgroundColor: accent,\n borderLeftColor: paper,\n borderLeftStyle: \"dashed\",\n borderLeftWidth: 1.5,\n justifyContent: \"space-between\",\n paddingBottom: 14,\n paddingHorizontal: 12,\n paddingTop: 16,\n width: STUB_WIDTH,\n },\n terms: {\n color: quiet,\n flex: 1,\n fontSize: 6.5,\n lineHeight: 1.4,\n paddingRight: 8,\n },\n title: {\n color: ink,\n fontSize: 26,\n fontWeight: \"bold\",\n letterSpacing: -0.6,\n lineHeight: 1.08,\n marginBottom: 8,\n },\n value: {\n color: ink,\n fontSize: 12,\n fontWeight: \"bold\",\n },\n venue: {\n color: quiet,\n fontSize: 10,\n lineHeight: 1.4,\n },\n });\n\n return (\n <Document title={`${data.eventName} ${data.ticketNumber}`}>\n <Page size={TICKET_SIZE} style={styles.page}>\n <View style={styles.stripe} />\n\n <View style={styles.body}>\n <View>\n <View style={styles.brand}>\n {data.logoUrl && (\n <PdfImage\n fit=\"contain\"\n src={data.logoUrl}\n style={styles.logo}\n />\n )}\n <Text noMargin style={styles.organizer}>\n {data.organizer ?? \"Event ticket\"}\n </Text>\n <View style={styles.pill}>\n <Text noMargin style={styles.pillText}>\n {data.ticketType}\n </Text>\n </View>\n </View>\n <Text noMargin style={styles.title}>\n {data.eventName}\n </Text>\n <Text noMargin style={styles.venue}>\n {data.venue}\n </Text>\n <Text noMargin style={styles.venue}>\n {data.address}\n </Text>\n </View>\n\n <View>\n <View style={styles.facts}>\n <View style={styles.fact}>\n <Text noMargin style={styles.label}>\n Date\n </Text>\n <Text noMargin style={styles.value}>\n {data.eventDate}\n </Text>\n </View>\n <View style={styles.fact}>\n <Text noMargin style={styles.label}>\n Time\n </Text>\n <Text noMargin style={styles.value}>\n {data.eventTime}\n </Text>\n </View>\n {data.doorsOpen && (\n <View style={styles.fact}>\n <Text noMargin style={styles.label}>\n Doors\n </Text>\n <Text noMargin style={styles.value}>\n {data.doorsOpen}\n </Text>\n </View>\n )}\n {data.seat && (\n <View style={styles.fact}>\n <Text noMargin style={styles.label}>\n Seat\n </Text>\n <Text noMargin style={styles.value}>\n {`${data.seat.section}–${data.seat.row}–${data.seat.number}`}\n </Text>\n </View>\n )}\n </View>\n {(data.terms ||\n (data.socialLinks && data.socialLinks.length > 0)) && (\n <View style={styles.footer}>\n {data.terms && (\n <Text noMargin style={styles.terms}>\n {data.terms}\n </Text>\n )}\n {data.socialLinks && data.socialLinks.length > 0 && (\n <View style={styles.socialList}>\n {data.socialLinks.map((link) => (\n <View\n key={`${link.platform}-${link.url}`}\n style={styles.socialItem}\n >\n <Text noMargin style={styles.socialLabel}>\n {link.platform}\n </Text>\n <Text noMargin style={styles.socialValue}>\n {socialHandle(link.url)}\n </Text>\n </View>\n ))}\n </View>\n )}\n </View>\n )}\n </View>\n </View>\n\n <View style={styles.stub}>\n <Text noMargin style={styles.admit}>\n Admit one\n </Text>\n <View style={styles.qr}>\n {data.qrCodeUrl ? (\n <PdfImage\n fit=\"contain\"\n height={68}\n src={data.qrCodeUrl}\n width={68}\n />\n ) : (\n <PdfQRCode\n backgroundColor=\"#ffffff\"\n color=\"#000000\"\n size={68}\n value={data.ticketNumber}\n />\n )}\n </View>\n <Text noMargin style={styles.serial}>\n {data.ticketNumber}\n </Text>\n </View>\n\n <View style={[styles.notch, { top: -NOTCH_RADIUS }]} />\n <View style={[styles.notch, { bottom: -NOTCH_RADIUS }]} />\n </Page>\n </Document>\n );\n};\n\nexport const EventTicketDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: EventTicketData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <EventTicketContent data={data} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/event-ticket/event-ticket.tsx"
},
@@ -29,4 +29,4 @@
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/form.json b/apps/web/public/r/takumi/form.json
index 757748f..9216bcd 100644
--- a/apps/web/public/r/takumi/form.json
+++ b/apps/web/public/r/takumi/form.json
@@ -13,22 +13,22 @@
"files": [
{
"path": "registry/bases/takumi/components/form/form.styles.ts",
- "content": "import { StyleSheet } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { PdfFormVariant } from \"./form.types\";\r\n\r\n/** Style factory for fillable form layouts, derived from the active theme. */\r\nexport const createFormStyles = (\r\n t: PdfcnTheme,\r\n variant: PdfFormVariant = \"underline\"\r\n) => {\r\n const { spacing, borderRadius, fontWeights, typography } = t.primitives;\r\n const borderColor = t.colors.border;\r\n // lighter than spacing[0.5]=2pt — more refined\r\n const hairline = 0.75;\r\n // group title rule\r\n const rule = 1;\r\n\r\n const fieldAreaByVariant: Record<PdfFormVariant, object> = {\r\n box: {\r\n borderColor,\r\n borderRadius: borderRadius.sm,\r\n borderStyle: \"solid\",\r\n borderWidth: hairline,\r\n },\r\n ghost: {\r\n backgroundColor: t.colors.muted,\r\n borderRadius: borderRadius.sm,\r\n },\r\n outlined: {\r\n borderColor: t.colors.foreground,\r\n borderRadius: borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: hairline,\r\n },\r\n underline: {\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: 1,\r\n },\r\n };\r\n\r\n const hasPadding =\r\n variant === \"box\" || variant === \"outlined\" || variant === \"ghost\";\r\n\r\n return StyleSheet.create({\r\n column: {\r\n flex: 1,\r\n },\r\n\r\n columnsRow: {\r\n flexDirection: \"row\",\r\n gap: spacing[4],\r\n },\r\n fieldAbove: {\r\n marginBottom: spacing[3],\r\n width: \"100%\",\r\n },\r\n fieldArea: {\r\n width: \"100%\" as const,\r\n ...fieldAreaByVariant[variant],\r\n },\r\n\r\n fieldLeft: {\r\n alignItems: \"flex-end\",\r\n flexDirection: \"row\",\r\n gap: spacing[2],\r\n marginBottom: spacing[3],\r\n },\r\n fieldLeftArea: {\r\n flex: 1,\r\n },\r\n\r\n formDivider: {\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: rule,\r\n marginBottom: spacing[4],\r\n },\r\n formSubtitle: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.sm,\r\n lineHeight: t.typography.body.lineHeight,\r\n marginBottom: spacing[3],\r\n },\r\n\r\n formTitle: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.heading.fontFamily,\r\n fontSize: typography.xl,\r\n fontWeight: fontWeights.bold,\r\n lineHeight: t.typography.heading.lineHeight,\r\n marginBottom: spacing[1],\r\n },\r\n group: {\r\n marginBottom: spacing[5],\r\n },\r\n\r\n groupTitle: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.xs,\r\n fontWeight: fontWeights.semibold,\r\n letterSpacing: 0.8,\r\n lineHeight: 1.2,\r\n marginBottom: spacing[3],\r\n textTransform: \"uppercase\",\r\n },\r\n hint: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.xs,\r\n opacity: 0.14,\r\n paddingBottom: hasPadding ? spacing[1] : 0,\r\n paddingHorizontal: hasPadding ? spacing[2] : 0,\r\n paddingTop: hasPadding ? spacing[1] : spacing[0.5],\r\n },\r\n labelAbove: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.xs,\r\n fontWeight: fontWeights.medium,\r\n letterSpacing: 0.5,\r\n lineHeight: 1.2,\r\n marginBottom: spacing[1],\r\n textTransform: \"uppercase\",\r\n },\r\n\r\n labelLeft: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n fontWeight: fontWeights.medium,\r\n lineHeight: t.typography.body.lineHeight,\r\n paddingBottom: hasPadding ? spacing[1] : 0,\r\n width: 80,\r\n },\r\n\r\n root: {\r\n marginBottom: t.spacing.componentGap,\r\n width: \"100%\",\r\n },\r\n });\r\n};\r\n",
+ "content": "import { StyleSheet } from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { PdfFormVariant } from \"./form.types\";\n\n/** Style factory for fillable form layouts, derived from the active theme. */\nexport const createFormStyles = (\n t: PdfcnTheme,\n variant: PdfFormVariant = \"underline\"\n) => {\n const { spacing, borderRadius, fontWeights, typography } = t.primitives;\n const borderColor = t.colors.border;\n // lighter than spacing[0.5]=2pt — more refined\n const hairline = 0.75;\n // group title rule\n const rule = 1;\n\n const fieldAreaByVariant: Record<PdfFormVariant, object> = {\n box: {\n borderColor,\n borderRadius: borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: hairline,\n },\n ghost: {\n backgroundColor: t.colors.muted,\n borderRadius: borderRadius.sm,\n },\n outlined: {\n borderColor: t.colors.foreground,\n borderRadius: borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: hairline,\n },\n underline: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n },\n };\n\n const hasPadding =\n variant === \"box\" || variant === \"outlined\" || variant === \"ghost\";\n\n return StyleSheet.create({\n column: {\n flex: 1,\n },\n\n columnsRow: {\n flexDirection: \"row\",\n gap: spacing[4],\n },\n fieldAbove: {\n marginBottom: spacing[3],\n width: \"100%\",\n },\n fieldArea: {\n width: \"100%\" as const,\n ...fieldAreaByVariant[variant],\n },\n\n fieldLeft: {\n alignItems: \"flex-end\",\n flexDirection: \"row\",\n gap: spacing[2],\n marginBottom: spacing[3],\n },\n fieldLeftArea: {\n flex: 1,\n },\n\n formDivider: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n marginBottom: spacing[4],\n },\n formSubtitle: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n lineHeight: t.typography.body.lineHeight,\n marginBottom: spacing[3],\n },\n\n formTitle: {\n color: t.colors.foreground,\n fontFamily: t.typography.heading.fontFamily,\n fontSize: typography.xl,\n fontWeight: fontWeights.bold,\n lineHeight: t.typography.heading.lineHeight,\n marginBottom: spacing[1],\n },\n group: {\n marginBottom: spacing[5],\n },\n\n groupTitle: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.8,\n lineHeight: 1.2,\n marginBottom: spacing[3],\n textTransform: \"uppercase\",\n },\n hint: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n opacity: 0.14,\n paddingBottom: hasPadding ? spacing[1] : 0,\n paddingHorizontal: hasPadding ? spacing[2] : 0,\n paddingTop: hasPadding ? spacing[1] : spacing[0.5],\n },\n labelAbove: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.medium,\n letterSpacing: 0.5,\n lineHeight: 1.2,\n marginBottom: spacing[1],\n textTransform: \"uppercase\",\n },\n\n labelLeft: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.medium,\n lineHeight: t.typography.body.lineHeight,\n paddingBottom: hasPadding ? spacing[1] : 0,\n width: 80,\n },\n\n root: {\n marginBottom: t.spacing.componentGap,\n width: \"100%\",\n },\n });\n};\n",
"type": "registry:component",
"target": "components/pdf/form/form.styles.ts"
},
{
"path": "registry/bases/takumi/components/form/form.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n Text as PDFText,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\n\r\nimport { createFormStyles } from \"./form.styles\";\r\nimport type {\r\n FormLayout,\r\n PdfFormField,\r\n PdfFormGroup,\r\n PdfFormProps,\r\n} from \"./form.types\";\r\n\r\nconst renderFieldAbove = (\r\n field: PdfFormField,\r\n idx: number,\r\n styles: ReturnType<typeof createFormStyles>\r\n) => {\r\n const areaHeight = field.height ?? 18;\r\n const areaStyle: Style[] = [styles.fieldArea, { minHeight: areaHeight }];\r\n\r\n return (\r\n <View key={`${field.label}-${idx}`} style={styles.fieldAbove}>\r\n <PDFText style={styles.labelAbove}>{field.label}</PDFText>\r\n <View style={areaStyle}>\r\n {field.hint ? (\r\n <PDFText style={styles.hint}>{field.hint}</PDFText>\r\n ) : null}\r\n </View>\r\n </View>\r\n );\r\n};\r\n\r\nconst renderFieldLeft = (\r\n field: PdfFormField,\r\n idx: number,\r\n styles: ReturnType<typeof createFormStyles>\r\n) => {\r\n const areaHeight = field.height ?? 18;\r\n const areaStyle: Style[] = [\r\n styles.fieldArea,\r\n styles.fieldLeftArea,\r\n { minHeight: areaHeight },\r\n ];\r\n\r\n return (\r\n <View key={`${field.label}-${idx}`} style={styles.fieldLeft}>\r\n <PDFText style={styles.labelLeft}>{field.label}</PDFText>\r\n <View style={areaStyle}>\r\n {field.hint ? (\r\n <PDFText style={styles.hint}>{field.hint}</PDFText>\r\n ) : null}\r\n </View>\r\n </View>\r\n );\r\n};\r\n\r\nconst renderGroup = (\r\n group: PdfFormGroup,\r\n gi: number,\r\n styles: ReturnType<typeof createFormStyles>,\r\n labelPosition: \"above\" | \"left\"\r\n) => {\r\n const layout: FormLayout = group.layout ?? \"single\";\r\n let cols: number;\r\n if (layout === \"three-column\") {\r\n cols = 3;\r\n } else if (layout === \"two-column\") {\r\n cols = 2;\r\n } else {\r\n cols = 1;\r\n }\r\n\r\n const renderField = (field: PdfFormField, idx: number) =>\r\n labelPosition === \"left\"\r\n ? renderFieldLeft(field, idx, styles)\r\n : renderFieldAbove(field, idx, styles);\r\n\r\n if (cols === 1) {\r\n return (\r\n <View key={`group-${gi}`} style={styles.group}>\r\n {group.title ? (\r\n <PDFText style={styles.groupTitle}>{group.title}</PDFText>\r\n ) : null}\r\n {group.fields.map(renderField)}\r\n </View>\r\n );\r\n }\r\n\r\n const chunkSize = Math.ceil(group.fields.length / cols);\r\n const chunks: PdfFormField[][] = [];\r\n for (let i = 0; i < group.fields.length; i += chunkSize) {\r\n chunks.push(group.fields.slice(i, i + chunkSize));\r\n }\r\n while (chunks.length < cols) {\r\n chunks.push([]);\r\n }\r\n\r\n return (\r\n <View key={`group-${gi}`} style={styles.group}>\r\n {group.title ? (\r\n <PDFText style={styles.groupTitle}>{group.title}</PDFText>\r\n ) : null}\r\n <View style={styles.columnsRow}>\r\n {chunks.map((chunk, ci) => (\r\n <View\r\n key={`col-${gi}-${chunk[0]?.label ?? ci}`}\r\n style={styles.column}\r\n >\r\n {chunk.map(renderField)}\r\n </View>\r\n ))}\r\n </View>\r\n </View>\r\n );\r\n};\r\n\r\nexport const PdfForm = ({\r\n title,\r\n subtitle,\r\n groups,\r\n variant = \"underline\",\r\n labelPosition = \"above\",\r\n noWrap = false,\r\n style,\r\n}: PdfFormProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(\r\n () => createFormStyles(theme, variant),\r\n [theme, variant]\r\n );\r\n\r\n const rootStyles: Style[] = [styles.root];\r\n if (style) {\r\n rootStyles.push(style);\r\n }\r\n\r\n const inner = (\r\n <View style={rootStyles}>\r\n {title ? <PDFText style={styles.formTitle}>{title}</PDFText> : null}\r\n {subtitle ? (\r\n <PDFText style={styles.formSubtitle}>{subtitle}</PDFText>\r\n ) : null}\r\n {title || subtitle ? <View style={styles.formDivider} /> : null}\r\n {groups.map((group, gi) => renderGroup(group, gi, styles, labelPosition))}\r\n </View>\r\n );\r\n\r\n return noWrap ? (\r\n <View style={[{ breakInside: \"avoid\" as const }].filter(Boolean)}>\r\n {inner}\r\n </View>\r\n ) : (\r\n inner\r\n );\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n Text as PDFText,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\n\nimport { createFormStyles } from \"./form.styles\";\nimport type {\n FormLayout,\n PdfFormField,\n PdfFormGroup,\n PdfFormProps,\n} from \"./form.types\";\n\nconst renderFieldAbove = (\n field: PdfFormField,\n idx: number,\n styles: ReturnType<typeof createFormStyles>\n) => {\n const areaHeight = field.height ?? 18;\n const areaStyle: Style[] = [styles.fieldArea, { minHeight: areaHeight }];\n\n return (\n <View key={`${field.label}-${idx}`} style={styles.fieldAbove}>\n <PDFText style={styles.labelAbove}>{field.label}</PDFText>\n <View style={areaStyle}>\n {field.hint ? (\n <PDFText style={styles.hint}>{field.hint}</PDFText>\n ) : null}\n </View>\n </View>\n );\n};\n\nconst renderFieldLeft = (\n field: PdfFormField,\n idx: number,\n styles: ReturnType<typeof createFormStyles>\n) => {\n const areaHeight = field.height ?? 18;\n const areaStyle: Style[] = [\n styles.fieldArea,\n styles.fieldLeftArea,\n { minHeight: areaHeight },\n ];\n\n return (\n <View key={`${field.label}-${idx}`} style={styles.fieldLeft}>\n <PDFText style={styles.labelLeft}>{field.label}</PDFText>\n <View style={areaStyle}>\n {field.hint ? (\n <PDFText style={styles.hint}>{field.hint}</PDFText>\n ) : null}\n </View>\n </View>\n );\n};\n\nconst renderGroup = (\n group: PdfFormGroup,\n gi: number,\n styles: ReturnType<typeof createFormStyles>,\n labelPosition: \"above\" | \"left\"\n) => {\n const layout: FormLayout = group.layout ?? \"single\";\n let cols: number;\n if (layout === \"three-column\") {\n cols = 3;\n } else if (layout === \"two-column\") {\n cols = 2;\n } else {\n cols = 1;\n }\n\n const renderField = (field: PdfFormField, idx: number) =>\n labelPosition === \"left\"\n ? renderFieldLeft(field, idx, styles)\n : renderFieldAbove(field, idx, styles);\n\n if (cols === 1) {\n return (\n <View key={`group-${gi}`} style={styles.group}>\n {group.title ? (\n <PDFText style={styles.groupTitle}>{group.title}</PDFText>\n ) : null}\n {group.fields.map(renderField)}\n </View>\n );\n }\n\n const chunkSize = Math.ceil(group.fields.length / cols);\n const chunks: PdfFormField[][] = [];\n for (let i = 0; i < group.fields.length; i += chunkSize) {\n chunks.push(group.fields.slice(i, i + chunkSize));\n }\n while (chunks.length < cols) {\n chunks.push([]);\n }\n\n return (\n <View key={`group-${gi}`} style={styles.group}>\n {group.title ? (\n <PDFText style={styles.groupTitle}>{group.title}</PDFText>\n ) : null}\n <View style={styles.columnsRow}>\n {chunks.map((chunk, ci) => (\n <View\n key={`col-${gi}-${chunk[0]?.label ?? ci}`}\n style={styles.column}\n >\n {chunk.map(renderField)}\n </View>\n ))}\n </View>\n </View>\n );\n};\n\nexport const PdfForm = ({\n title,\n subtitle,\n groups,\n variant = \"underline\",\n labelPosition = \"above\",\n noWrap = false,\n style,\n}: PdfFormProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(\n () => createFormStyles(theme, variant),\n [theme, variant]\n );\n\n const rootStyles: Style[] = [styles.root];\n if (style) {\n rootStyles.push(style);\n }\n\n const inner = (\n <View style={rootStyles}>\n {title ? <PDFText style={styles.formTitle}>{title}</PDFText> : null}\n {subtitle ? (\n <PDFText style={styles.formSubtitle}>{subtitle}</PDFText>\n ) : null}\n {title || subtitle ? <View style={styles.formDivider} /> : null}\n {groups.map((group, gi) => renderGroup(group, gi, styles, labelPosition))}\n </View>\n );\n\n return noWrap ? (\n <View style={[{ breakInside: \"avoid\" as const }].filter(Boolean)}>\n {inner}\n </View>\n ) : (\n inner\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/form/form.tsx"
},
{
"path": "registry/bases/takumi/components/form/form.types.ts",
- "content": "import type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\n\r\n/** Visual style variant for the fillable form. */\r\nexport type PdfFormVariant = \"underline\" | \"box\" | \"outlined\" | \"ghost\";\r\n\r\n/** Column layout for a form section. */\r\nexport type FormLayout = \"single\" | \"two-column\" | \"three-column\";\r\n\r\n/** Label position relative to the field. */\r\nexport type FormLabelPosition = \"above\" | \"left\";\r\n\r\n/**\r\n * A single fillable field definition.\r\n * Props - `label` | `hint` | `height` | `width`\r\n * @see {@link PdfFormField}\r\n */\r\nexport interface PdfFormField {\r\n label: string;\r\n hint?: string;\r\n /**\r\n * Height of the blank field area in points.\r\n * @default 18\r\n */\r\n height?: number;\r\n width?: number | string;\r\n}\r\n\r\n/**\r\n * A logical group of fields with an optional section title.\r\n * Props - `title` | `fields` | `layout`\r\n * @see {@link PdfFormGroup}\r\n */\r\nexport interface PdfFormGroup {\r\n title?: string;\r\n fields: PdfFormField[];\r\n /**\r\n * @default 'single'\r\n */\r\n layout?: FormLayout;\r\n}\r\n\r\n/**\r\n * Fillable PDF form with grouped fields, layout variants, and label positioning options.\r\n * Props - `title` | `subtitle` | `groups` | `variant` | `labelPosition` | `noWrap` | `style`\r\n * @see {@link PdfFormProps}\r\n */\r\nexport interface PdfFormProps {\r\n title?: string;\r\n subtitle?: string;\r\n groups: PdfFormGroup[];\r\n /**\r\n * @default 'underline'\r\n */\r\n variant?: PdfFormVariant;\r\n /**\r\n * @default 'above'\r\n */\r\n labelPosition?: FormLabelPosition;\r\n noWrap?: boolean;\r\n style?: Style;\r\n}\r\n",
+ "content": "import type { Style } from \"@/lib/pdf-primitives\";\n\n/** Visual style variant for the fillable form. */\nexport type PdfFormVariant = \"underline\" | \"box\" | \"outlined\" | \"ghost\";\n\n/** Column layout for a form section. */\nexport type FormLayout = \"single\" | \"two-column\" | \"three-column\";\n\n/** Label position relative to the field. */\nexport type FormLabelPosition = \"above\" | \"left\";\n\n/**\n * A single fillable field definition.\n * Props - `label` | `hint` | `height` | `width`\n * @see {@link PdfFormField}\n */\nexport interface PdfFormField {\n label: string;\n hint?: string;\n /**\n * Height of the blank field area in points.\n * @default 18\n */\n height?: number;\n width?: number | string;\n}\n\n/**\n * A logical group of fields with an optional section title.\n * Props - `title` | `fields` | `layout`\n * @see {@link PdfFormGroup}\n */\nexport interface PdfFormGroup {\n title?: string;\n fields: PdfFormField[];\n /**\n * @default 'single'\n */\n layout?: FormLayout;\n}\n\n/**\n * Fillable PDF form with grouped fields, layout variants, and label positioning options.\n * Props - `title` | `subtitle` | `groups` | `variant` | `labelPosition` | `noWrap` | `style`\n * @see {@link PdfFormProps}\n */\nexport interface PdfFormProps {\n title?: string;\n subtitle?: string;\n groups: PdfFormGroup[];\n /**\n * @default 'underline'\n */\n variant?: PdfFormVariant;\n /**\n * @default 'above'\n */\n labelPosition?: FormLabelPosition;\n noWrap?: boolean;\n style?: Style;\n}\n",
"type": "registry:component",
"target": "components/pdf/form/form.types.ts"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/gift-certificate.json b/apps/web/public/r/takumi/gift-certificate.json
index a912b80..b25b216 100644
--- a/apps/web/public/r/takumi/gift-certificate.json
+++ b/apps/web/public/r/takumi/gift-certificate.json
@@ -10,13 +10,14 @@
"registryDependencies": [
"@pdfcn/takumi/utils",
"@pdfcn/takumi/page-footer",
+ "@pdfcn/takumi/pdf-image",
"@pdfcn/takumi/section",
"@pdfcn/takumi/text"
],
"files": [
{
"path": "registry/bases/takumi/blocks/gift-certificate/gift-certificate.tsx",
- "content": "import { PageFooter } from \"@/registry/bases/takumi/components/page-footer/page-footer\";\nimport { PdfImage } from \"@/registry/bases/takumi/components/pdf-image/pdf-image\";\nimport { Section } from \"@/registry/bases/takumi/components/section/section\";\nimport { Text } from \"@/registry/bases/takumi/components/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type { GiftCertificateData } from \"./gift-certificate.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: GiftCertificateData = {\n companyName: \"pdfcn\",\n companyLogo: \"/favicon.png\",\n amount: 50,\n currency: \"USD\",\n recipientName: \"Sarah\",\n senderName: \"Mom & Dad\",\n message: \"Happy Birthday! Enjoy a coffee on us.\",\n certificateCode: \"PDFCN-GC-2026-00891\",\n expiryDate: \"March 31, 2027\",\n redemptionInstructions:\n \"Present this certificate at any pdfcn location.\",\n terms: \"No cash value. Non-refundable. One use per visit.\",\n accentColor: \"#000000\",\n};\n\nconst GiftCertificateContent = ({ data }: { data: GiftCertificateData }) => {\n const theme = usePdfcnTheme();\n const accentColor = data.accentColor || \"#000000\";\n const currencySymbol = data.currency === \"USD\" ? \"$\" : data.currency || \"$\";\n\n const styles = StyleSheet.create({\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 595,\n padding: 24,\n paddingBottom: 24,\n position: \"relative\",\n },\n decorativeBorder: {\n borderColor: accentColor,\n borderRadius: theme.primitives.borderRadius.lg,\n borderStyle: \"solid\",\n borderWidth: 3,\n padding: 16,\n position: \"relative\",\n },\n innerBorder: {\n borderColor: accentColor,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"dashed\",\n borderWidth: 1,\n padding: 18,\n },\n header: {\n alignItems: \"center\",\n marginBottom: 8,\n },\n title: {\n color: accentColor,\n fontSize: 22,\n fontWeight: \"bold\",\n letterSpacing: 2,\n textAlign: \"center\",\n textTransform: \"uppercase\",\n },\n amountContainer: {\n alignItems: \"center\",\n backgroundColor: theme.colors.muted,\n borderColor: accentColor,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 2,\n marginBottom: 10,\n marginTop: 10,\n paddingHorizontal: 20,\n paddingVertical: 12,\n },\n amount: {\n color: accentColor,\n fontSize: 36,\n fontWeight: \"bold\",\n },\n fieldLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n fontWeight: \"bold\",\n letterSpacing: 1,\n marginBottom: 4,\n textTransform: \"uppercase\",\n },\n fieldValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: 500,\n },\n messageBox: {\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.sm,\n marginBottom: 8,\n marginTop: 8,\n padding: 10,\n },\n codeBox: {\n alignItems: \"center\",\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: 1,\n marginBottom: 8,\n marginTop: 8,\n paddingHorizontal: 14,\n paddingVertical: 8,\n },\n code: {\n color: theme.colors.foreground,\n fontFamily: \"Courier\",\n fontSize: 13,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n },\n instructionsBox: {\n marginTop: 8,\n },\n logo: {\n height: 28,\n marginBottom: 6,\n width: 28,\n },\n termsText: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n lineHeight: 1.4,\n textAlign: \"center\",\n },\n });\n\n return (\n <Document title={`Gift Certificate ${data.certificateCode}`}>\n <Page size={{ width: 841, height: 595 }} style={styles.page}>\n <View style={styles.decorativeBorder}>\n <View style={styles.innerBorder}>\n <Section noWrap style={styles.header}>\n {data.companyLogo && (\n <PdfImage\n src={data.companyLogo ?? \"/favicon.png\"}\n style={styles.logo}\n />\n )}\n <Text style={styles.title} noMargin>\n Gift Certificate\n </Text>\n {data.companyName && (\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 13,\n fontWeight: 500,\n marginTop: 4,\n textAlign: \"center\",\n }}\n noMargin\n >\n {data.companyName}\n </Text>\n )}\n </Section>\n\n <Section noWrap style={styles.amountContainer}>\n <Text style={styles.amount} noMargin>\n {currencySymbol}\n {data.amount.toFixed(2)}\n </Text>\n </Section>\n\n <Section\n noWrap\n style={{\n flexDirection: \"row\",\n gap: 28,\n marginBottom: 8,\n }}\n >\n <View style={{ flex: 1 }}>\n <Text style={styles.fieldLabel} noMargin>\n To\n </Text>\n <Text style={styles.fieldValue} noMargin>\n {data.recipientName}\n </Text>\n </View>\n <View style={{ flex: 1 }}>\n <Text style={styles.fieldLabel} noMargin>\n From\n </Text>\n <Text style={styles.fieldValue} noMargin>\n {data.senderName}\n </Text>\n </View>\n </Section>\n\n {data.message && (\n <Section noWrap style={styles.messageBox}>\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 10,\n fontStyle: \"italic\",\n lineHeight: 1.4,\n textAlign: \"center\",\n }}\n noMargin\n >\n \"{data.message}\"\n </Text>\n </Section>\n )}\n\n <Section noWrap style={styles.codeBox}>\n <Text style={styles.fieldLabel} noMargin>\n Certificate Code\n </Text>\n <Text style={styles.code} noMargin>\n {data.certificateCode}\n </Text>\n </Section>\n\n <Section\n noWrap\n style={{\n alignItems: \"center\",\n marginBottom: 8,\n }}\n >\n <Text style={styles.fieldLabel} noMargin>\n Valid Until\n </Text>\n <Text\n style={{\n color: accentColor,\n fontSize: 12,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n {data.expiryDate}\n </Text>\n </Section>\n\n {data.redemptionInstructions && (\n <Section noWrap style={styles.instructionsBox}>\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 9,\n lineHeight: 1.3,\n textAlign: \"center\",\n }}\n noMargin\n >\n {data.redemptionInstructions}\n </Text>\n </Section>\n )}\n\n {data.terms && (\n <Section\n noWrap\n style={{\n marginTop: 10,\n }}\n >\n <Text style={styles.termsText} noMargin>\n {data.terms}\n </Text>\n </Section>\n )}\n </View>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const GiftCertificateDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: GiftCertificateData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <GiftCertificateContent data={data} />\n </PdfcnThemeProvider>\n);\n",
+ "content": "import { PdfImage } from \"@/components/pdf/pdf-image/pdf-image\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { GiftCertificateData } from \"./gift-certificate.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: GiftCertificateData = {\n accentColor: \"#000000\",\n amount: 50,\n certificateCode: \"PDFCN-GC-2026-00891\",\n companyLogo: \"/favicon.png\",\n companyName: \"pdfcn\",\n currency: \"USD\",\n expiryDate: \"March 31, 2027\",\n message: \"Happy Birthday! Enjoy a coffee on us.\",\n recipientName: \"Sarah\",\n redemptionInstructions: \"Present this certificate at any pdfcn location.\",\n senderName: \"Mom & Dad\",\n terms: \"No cash value. Non-refundable. One use per visit.\",\n};\n\nconst GiftCertificateContent = ({ data }: { data: GiftCertificateData }) => {\n const theme = usePdfcnTheme();\n const accentColor = data.accentColor || \"#000000\";\n const currencySymbol = data.currency === \"USD\" ? \"$\" : data.currency || \"$\";\n\n const styles = StyleSheet.create({\n amount: {\n color: accentColor,\n fontSize: 36,\n fontWeight: \"bold\",\n },\n amountContainer: {\n alignItems: \"center\",\n backgroundColor: theme.colors.muted,\n borderColor: accentColor,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 2,\n marginBottom: 10,\n marginTop: 10,\n paddingHorizontal: 20,\n paddingVertical: 12,\n },\n code: {\n color: theme.colors.foreground,\n fontFamily: \"Courier\",\n fontSize: 13,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n },\n codeBox: {\n alignItems: \"center\",\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: 1,\n marginBottom: 8,\n marginTop: 8,\n paddingHorizontal: 14,\n paddingVertical: 8,\n },\n decorativeBorder: {\n borderColor: accentColor,\n borderRadius: theme.primitives.borderRadius.lg,\n borderStyle: \"solid\",\n borderWidth: 3,\n padding: 16,\n position: \"relative\",\n },\n fieldLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n fontWeight: \"bold\",\n letterSpacing: 1,\n marginBottom: 4,\n textTransform: \"uppercase\",\n },\n fieldValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: 500,\n },\n header: {\n alignItems: \"center\",\n marginBottom: 8,\n },\n innerBorder: {\n borderColor: accentColor,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"dashed\",\n borderWidth: 1,\n padding: 18,\n },\n instructionsBox: {\n marginTop: 8,\n },\n logo: {\n height: 28,\n marginBottom: 6,\n width: 28,\n },\n messageBox: {\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.sm,\n marginBottom: 8,\n marginTop: 8,\n padding: 10,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 595,\n padding: 24,\n paddingBottom: 24,\n position: \"relative\",\n },\n termsText: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n lineHeight: 1.4,\n textAlign: \"center\",\n },\n title: {\n color: accentColor,\n fontSize: 22,\n fontWeight: \"bold\",\n letterSpacing: 2,\n textAlign: \"center\",\n textTransform: \"uppercase\",\n },\n });\n\n return (\n <Document title={`Gift Certificate ${data.certificateCode}`}>\n <Page size={{ height: 595, width: 841 }} style={styles.page}>\n <View style={styles.decorativeBorder}>\n <View style={styles.innerBorder}>\n <Section noWrap style={styles.header}>\n {data.companyLogo && (\n <PdfImage\n src={data.companyLogo ?? \"/favicon.png\"}\n style={styles.logo}\n />\n )}\n <Text style={styles.title} noMargin>\n Gift Certificate\n </Text>\n {data.companyName && (\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 13,\n fontWeight: 500,\n marginTop: 4,\n textAlign: \"center\",\n }}\n noMargin\n >\n {data.companyName}\n </Text>\n )}\n </Section>\n\n <Section noWrap style={styles.amountContainer}>\n <Text style={styles.amount} noMargin>\n {currencySymbol}\n {data.amount.toFixed(2)}\n </Text>\n </Section>\n\n <Section\n noWrap\n style={{\n flexDirection: \"row\",\n gap: 28,\n marginBottom: 8,\n }}\n >\n <View style={{ flex: 1 }}>\n <Text style={styles.fieldLabel} noMargin>\n To\n </Text>\n <Text style={styles.fieldValue} noMargin>\n {data.recipientName}\n </Text>\n </View>\n <View style={{ flex: 1 }}>\n <Text style={styles.fieldLabel} noMargin>\n From\n </Text>\n <Text style={styles.fieldValue} noMargin>\n {data.senderName}\n </Text>\n </View>\n </Section>\n\n {data.message && (\n <Section noWrap style={styles.messageBox}>\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 10,\n fontStyle: \"italic\",\n lineHeight: 1.4,\n textAlign: \"center\",\n }}\n noMargin\n >\n \"{data.message}\"\n </Text>\n </Section>\n )}\n\n <Section noWrap style={styles.codeBox}>\n <Text style={styles.fieldLabel} noMargin>\n Certificate Code\n </Text>\n <Text style={styles.code} noMargin>\n {data.certificateCode}\n </Text>\n </Section>\n\n <Section\n noWrap\n style={{\n alignItems: \"center\",\n marginBottom: 8,\n }}\n >\n <Text style={styles.fieldLabel} noMargin>\n Valid Until\n </Text>\n <Text\n style={{\n color: accentColor,\n fontSize: 12,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n {data.expiryDate}\n </Text>\n </Section>\n\n {data.redemptionInstructions && (\n <Section noWrap style={styles.instructionsBox}>\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 9,\n lineHeight: 1.3,\n textAlign: \"center\",\n }}\n noMargin\n >\n {data.redemptionInstructions}\n </Text>\n </Section>\n )}\n\n {data.terms && (\n <Section\n noWrap\n style={{\n marginTop: 10,\n }}\n >\n <Text style={styles.termsText} noMargin>\n {data.terms}\n </Text>\n </Section>\n )}\n </View>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const GiftCertificateDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: GiftCertificateData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <GiftCertificateContent data={data} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/gift-certificate/gift-certificate.tsx"
},
@@ -28,4 +29,4 @@
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/graph.json b/apps/web/public/r/takumi/graph.json
index 62e4bcb..de55161 100644
--- a/apps/web/public/r/takumi/graph.json
+++ b/apps/web/public/r/takumi/graph.json
@@ -13,28 +13,28 @@
"files": [
{
"path": "registry/bases/takumi/components/graph/graph.styles.ts",
- "content": "import { StyleSheet } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport const createGraphStyles = (t: PdfcnTheme) =>\r\n StyleSheet.create({\r\n chartWithRightLegend: {\r\n alignItems: \"flex-start\",\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n },\r\n container: {\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n marginBottom: t.spacing.componentGap,\r\n },\r\n legendColumn: {\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n gap: 8,\r\n marginLeft: 12,\r\n marginTop: 18,\r\n minWidth: 120,\r\n },\r\n legendItem: {\r\n alignItems: \"center\",\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n gap: 4,\r\n },\r\n legendRow: {\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n flexWrap: \"wrap\",\r\n gap: 12,\r\n marginTop: 6,\r\n },\r\n legendText: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n },\r\n subtitle: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n marginBottom: 6,\r\n },\r\n title: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.heading.fontFamily,\r\n fontSize: t.primitives.typography.base,\r\n fontWeight: t.primitives.fontWeights.semibold,\r\n marginBottom: 2,\r\n },\r\n });\r\n",
+ "content": "import { StyleSheet } from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport const createGraphStyles = (t: PdfcnTheme) =>\n StyleSheet.create({\n chartWithRightLegend: {\n alignItems: \"flex-start\",\n display: \"flex\",\n flexDirection: \"row\",\n },\n container: {\n display: \"flex\",\n flexDirection: \"column\",\n marginBottom: t.spacing.componentGap,\n },\n legendColumn: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: 8,\n marginLeft: 12,\n marginTop: 18,\n minWidth: 120,\n },\n legendItem: {\n alignItems: \"center\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: 4,\n },\n legendRow: {\n display: \"flex\",\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 12,\n marginTop: 6,\n },\n legendText: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n },\n subtitle: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginBottom: 6,\n },\n title: {\n color: t.colors.foreground,\n fontFamily: t.typography.heading.fontFamily,\n fontSize: t.primitives.typography.base,\n fontWeight: t.primitives.fontWeights.semibold,\n marginBottom: 2,\n },\n });\n",
"type": "registry:component",
"target": "components/pdf/graph/graph.styles.ts"
},
{
"path": "registry/bases/takumi/components/graph/graph.tsx",
- "content": "import type React from \"react\";\r\n\r\nimport {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n Text as PDFText,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport {\r\n Circle,\r\n G,\r\n Line,\r\n Path,\r\n Rect,\r\n Svg,\r\n SvgText,\r\n} from \"@/registry/bases/takumi/lib/pdf-svg\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport { createGraphStyles } from \"./graph.styles\";\r\nimport type { ChartLayout, GraphProps, GraphSeries } from \"./graph.types\";\r\nimport {\r\n GRAPH_SAFE_WIDTHS,\r\n arcPath,\r\n buildLayout,\r\n fmtNum,\r\n getDefaultPalette,\r\n getGraphWidth,\r\n normalizeData,\r\n polarToCartesian,\r\n smoothPath,\r\n truncate,\r\n} from \"./graph.utils\";\r\n\r\n/**\r\n * Shared Y-axis grid lines and tick labels for cartesian charts (bar, line, area).\r\n * Extracted to avoid duplicating the identical block across render functions.\r\n */\r\nconst renderGridAndYAxis = (\r\n ticks: number[],\r\n toY: (v: number) => number,\r\n chartX: number,\r\n chartW: number,\r\n showGrid: boolean,\r\n gridColor: string,\r\n textColor: string\r\n) => (\r\n <>\r\n {ticks.map((tick) => {\r\n const ty = toY(tick);\r\n return (\r\n <G key={`grid-${tick}`}>\r\n {showGrid && (\r\n <Line\r\n x1={chartX}\r\n y1={ty}\r\n x2={chartX + chartW}\r\n y2={ty}\r\n stroke={gridColor}\r\n strokeWidth={0.5}\r\n strokeDasharray=\"3 3\"\r\n />\r\n )}\r\n <SvgText\r\n x={chartX - 4}\r\n y={ty + 3}\r\n fill={textColor}\r\n textAnchor=\"end\"\r\n style={{ fontSize: 7 }}\r\n >\r\n {fmtNum(tick)}\r\n </SvgText>\r\n </G>\r\n );\r\n })}\r\n </>\r\n);\r\n\r\nconst renderBarChart = (\r\n series: GraphSeries[],\r\n layout: ChartLayout,\r\n palette: string[],\r\n showGrid: boolean,\r\n showValues: boolean,\r\n theme: PdfcnTheme\r\n) => {\r\n const { chartX, chartY, chartW, chartH, yMin, yMax, yTicks, xLabels } =\r\n layout;\r\n const nCategories = xLabels.length;\r\n const nSeries = series.length;\r\n const groupGap = 0.25;\r\n const groupW = chartW / nCategories;\r\n const barW = (groupW * (1 - groupGap)) / nSeries;\r\n const textColor = theme.colors.mutedForeground;\r\n const gridColor = theme.colors.border;\r\n const axisColor = theme.colors.foreground;\r\n const range = yMax - yMin || 1;\r\n const toY = (v: number) => chartY + chartH - ((v - yMin) / range) * chartH;\r\n\r\n return (\r\n <>\r\n {renderGridAndYAxis(\r\n yTicks,\r\n toY,\r\n chartX,\r\n chartW,\r\n showGrid,\r\n gridColor,\r\n textColor\r\n )}\r\n\r\n <Line\r\n x1={chartX}\r\n y1={chartY + chartH}\r\n x2={chartX + chartW}\r\n y2={chartY + chartH}\r\n stroke={axisColor}\r\n strokeWidth={1}\r\n />\r\n\r\n {xLabels.map((label, ci) => {\r\n const groupLeft = chartX + ci * groupW + groupW * (groupGap / 2);\r\n return (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\r\n <G key={`group-${ci}`}>\r\n {series.map((s, si) => {\r\n const val = s.data[ci]?.value ?? 0;\r\n const color =\r\n s.data[ci]?.color ?? s.color ?? palette[si % palette.length];\r\n const barH = ((val - yMin) / range) * chartH;\r\n const bx = groupLeft + si * barW;\r\n const by = chartY + chartH - barH;\r\n return (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\r\n <G key={`bar-${ci}-${si}`}>\r\n <Rect\r\n x={bx}\r\n y={by}\r\n width={barW - 1}\r\n height={barH}\r\n fill={color}\r\n />\r\n {showValues && barH > 10 && (\r\n <SvgText\r\n x={bx + barW / 2 - 0.5}\r\n y={by - 2}\r\n fill={axisColor}\r\n textAnchor=\"middle\"\r\n style={{ fontSize: 6 }}\r\n >\r\n {fmtNum(val)}\r\n </SvgText>\r\n )}\r\n </G>\r\n );\r\n })}\r\n <SvgText\r\n x={groupLeft + (nSeries * barW) / 2}\r\n y={chartY + chartH + 10}\r\n fill={textColor}\r\n textAnchor=\"middle\"\r\n style={{ fontSize: 7 }}\r\n >\r\n {truncate(label, 10)}\r\n </SvgText>\r\n </G>\r\n );\r\n })}\r\n </>\r\n );\r\n};\r\n\r\nconst renderHorizontalBarChart = (\r\n series: GraphSeries[],\r\n layout: ChartLayout,\r\n palette: string[],\r\n showValues: boolean,\r\n theme: PdfcnTheme\r\n) => {\r\n const { chartX, chartY, chartW, chartH, xLabels } = layout;\r\n const nCategories = xLabels.length;\r\n const allValues = series.flatMap((s) => s.data.map((d) => d.value));\r\n const maxVal = Math.max(...allValues, 1);\r\n const rowH = chartH / nCategories;\r\n const barH = rowH * 0.5;\r\n const textColor = theme.colors.mutedForeground;\r\n const axisColor = theme.colors.foreground;\r\n const labelW = 60;\r\n\r\n return (\r\n <>\r\n {xLabels.map((label, ci) => {\r\n const rowY = chartY + ci * rowH;\r\n const val = series[0]?.data[ci]?.value ?? 0;\r\n const color =\r\n series[0]?.data[ci]?.color ??\r\n series[0]?.color ??\r\n palette[ci % palette.length];\r\n const barW = (val / maxVal) * (chartW - labelW);\r\n return (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\r\n <G key={`hbar-${ci}`}>\r\n <SvgText\r\n x={chartX + labelW - 4}\r\n y={rowY + rowH / 2 + 3}\r\n fill={textColor}\r\n textAnchor=\"end\"\r\n style={{ fontSize: 7 }}\r\n >\r\n {truncate(label, 14)}\r\n </SvgText>\r\n <Rect\r\n x={chartX + labelW}\r\n y={rowY + (rowH - barH) / 2}\r\n width={Math.max(barW, 1)}\r\n height={barH}\r\n fill={color}\r\n />\r\n {showValues && (\r\n <SvgText\r\n x={chartX + labelW + barW + 3}\r\n y={rowY + rowH / 2 + 3}\r\n fill={axisColor}\r\n textAnchor=\"start\"\r\n style={{ fontSize: 6 }}\r\n >\r\n {fmtNum(val)}\r\n </SvgText>\r\n )}\r\n </G>\r\n );\r\n })}\r\n <Line\r\n x1={chartX + labelW}\r\n y1={chartY}\r\n x2={chartX + labelW}\r\n y2={chartY + chartH}\r\n stroke={axisColor}\r\n strokeWidth={1}\r\n />\r\n </>\r\n );\r\n};\r\n\r\nconst renderLineAreaChart = (\r\n series: GraphSeries[],\r\n layout: ChartLayout,\r\n palette: string[],\r\n showGrid: boolean,\r\n showValues: boolean,\r\n showDots: boolean,\r\n smooth: boolean,\r\n isArea: boolean,\r\n theme: PdfcnTheme\r\n) => {\r\n const { chartX, chartY, chartW, chartH, yMin, yMax, yTicks, xLabels } =\r\n layout;\r\n const range = yMax - yMin || 1;\r\n const textColor = theme.colors.mutedForeground;\r\n const gridColor = theme.colors.border;\r\n const axisColor = theme.colors.foreground;\r\n const nPoints = xLabels.length;\r\n\r\n const xFor = (i: number) => chartX + (i / Math.max(nPoints - 1, 1)) * chartW;\r\n const yFor = (v: number) => chartY + chartH - ((v - yMin) / range) * chartH;\r\n\r\n return (\r\n <>\r\n {renderGridAndYAxis(\r\n yTicks,\r\n yFor,\r\n chartX,\r\n chartW,\r\n showGrid,\r\n gridColor,\r\n textColor\r\n )}\r\n\r\n <Line\r\n x1={chartX}\r\n y1={chartY + chartH}\r\n x2={chartX + chartW}\r\n y2={chartY + chartH}\r\n stroke={axisColor}\r\n strokeWidth={1}\r\n />\r\n\r\n {series.map((s, si) => {\r\n const color = s.color ?? palette[si % palette.length];\r\n const points = s.data.map((d, i) => ({ x: xFor(i), y: yFor(d.value) }));\r\n\r\n const lineDStr = smooth\r\n ? smoothPath(points)\r\n : `M ${points.map((p) => `${p.x} ${p.y}`).join(\" L \")}`;\r\n\r\n const lastPoint = points.at(-1);\r\n const firstPoint = points.at(0);\r\n const areaPath =\r\n isArea && points.length > 1 && lastPoint && firstPoint\r\n ? `${lineDStr} L ${lastPoint.x} ${chartY + chartH} L ${firstPoint.x} ${chartY + chartH} Z`\r\n : null;\r\n\r\n return (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\r\n <G key={`series-${si}`}>\r\n {isArea && areaPath && (\r\n <Path d={areaPath} fill={color} fillOpacity={0.2} stroke=\"none\" />\r\n )}\r\n <Path d={lineDStr} stroke={color} strokeWidth={2} fill=\"none\" />\r\n {showDots &&\r\n points.map((p, pi) => (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\r\n <Circle\r\n key={`dot-${pi}`}\r\n cx={p.x}\r\n cy={p.y}\r\n r={3}\r\n fill={color}\r\n />\r\n ))}\r\n {showValues &&\r\n points.map((p, pi) => (\r\n <SvgText\r\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\r\n key={`val-${pi}`}\r\n x={p.x}\r\n y={p.y - 5}\r\n fill={color}\r\n textAnchor=\"middle\"\r\n style={{ fontSize: 6 }}\r\n >\r\n {fmtNum(s.data[pi].value)}\r\n </SvgText>\r\n ))}\r\n </G>\r\n );\r\n })}\r\n\r\n {xLabels.map((label, i) => (\r\n <SvgText\r\n key={`xlabel-${label}`}\r\n x={xFor(i)}\r\n y={chartY + chartH + 10}\r\n fill={textColor}\r\n textAnchor=\"middle\"\r\n style={{ fontSize: 7 }}\r\n >\r\n {truncate(label, 8)}\r\n </SvgText>\r\n ))}\r\n </>\r\n );\r\n};\r\n\r\nconst renderPieDonutChart = (\r\n series: GraphSeries[],\r\n layout: ChartLayout,\r\n palette: string[],\r\n centerLabel: string | undefined,\r\n isDonut: boolean,\r\n theme: PdfcnTheme\r\n) => {\r\n const { svgW, svgH } = layout;\r\n const cx = svgW / 2;\r\n const cy = svgH / 2;\r\n const r = Math.min(svgW, svgH) / 2 - 20;\r\n const innerR = isDonut ? r * 0.52 : 0;\r\n const textColor = theme.colors.mutedForeground;\r\n\r\n const data = series[0]?.data ?? [];\r\n const total = data.reduce((sum, d) => sum + d.value, 0) || 1;\r\n\r\n let currentAngle = 0;\r\n\r\n return (\r\n <>\r\n {data.map((d, i) => {\r\n const color = d.color ?? palette[i % palette.length];\r\n const sweep = (d.value / total) * 360;\r\n const midAngle = currentAngle + sweep / 2;\r\n const path = arcPath(\r\n cx,\r\n cy,\r\n r,\r\n currentAngle,\r\n currentAngle + sweep,\r\n innerR\r\n );\r\n currentAngle += sweep;\r\n\r\n const labelR = r * 1.18;\r\n const lp = polarToCartesian(cx, cy, labelR, midAngle);\r\n const anchor = lp.x > cx ? \"start\" : \"end\";\r\n\r\n return (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\r\n <G key={`slice-${i}`}>\r\n <Path d={path} fill={color} stroke=\"white\" strokeWidth={1} />\r\n {/* Show label only if slice is large enough to label */}\r\n {sweep > 15 && (\r\n <SvgText\r\n x={lp.x}\r\n y={lp.y + 3}\r\n fill={textColor}\r\n textAnchor={anchor}\r\n style={{ fontSize: 7 }}\r\n >\r\n {truncate(d.label, 10)}\r\n </SvgText>\r\n )}\r\n </G>\r\n );\r\n })}\r\n\r\n {isDonut && centerLabel && (\r\n <>\r\n <Circle cx={cx} cy={cy} r={innerR} fill=\"white\" />\r\n <SvgText\r\n x={cx}\r\n y={cy + 4}\r\n fill={theme.colors.foreground}\r\n textAnchor=\"middle\"\r\n style={{ fontSize: 9, fontWeight: \"bold\" }}\r\n >\r\n {centerLabel}\r\n </SvgText>\r\n </>\r\n )}\r\n </>\r\n );\r\n};\r\n\r\nconst Legend = ({\r\n series,\r\n palette,\r\n styles,\r\n position = \"bottom\",\r\n}: {\r\n series: GraphSeries[];\r\n palette: string[];\r\n styles: ReturnType<typeof createGraphStyles>;\r\n position?: \"bottom\" | \"right\";\r\n}) => {\r\n const containerStyle =\r\n position === \"right\" ? styles.legendColumn : styles.legendRow;\r\n\r\n return (\r\n <View style={containerStyle}>\r\n {series.map((s, i) => (\r\n <View key={s.name} style={styles.legendItem}>\r\n <Svg width={10} height={10}>\r\n <Rect\r\n x={0}\r\n y={2}\r\n width={8}\r\n height={8}\r\n fill={s.color ?? palette[i % palette.length]}\r\n />\r\n </Svg>\r\n <PDFText style={styles.legendText}>{s.name}</PDFText>\r\n </View>\r\n ))}\r\n </View>\r\n );\r\n};\r\n\r\nconst renderChartContent = (\r\n variant: string,\r\n series: GraphSeries[],\r\n layout: ChartLayout,\r\n palette: string[],\r\n showGrid: boolean,\r\n showValues: boolean,\r\n showDots: boolean,\r\n smooth: boolean,\r\n centerLabel: string | undefined,\r\n theme: PdfcnTheme\r\n): React.ReactNode => {\r\n switch (variant) {\r\n case \"bar\": {\r\n return renderBarChart(\r\n series,\r\n layout,\r\n palette,\r\n showGrid,\r\n showValues,\r\n theme\r\n );\r\n }\r\n case \"horizontal-bar\": {\r\n return renderHorizontalBarChart(\r\n series,\r\n layout,\r\n palette,\r\n showValues,\r\n theme\r\n );\r\n }\r\n case \"line\":\r\n case \"area\": {\r\n return renderLineAreaChart(\r\n series,\r\n layout,\r\n palette,\r\n showGrid,\r\n showValues,\r\n showDots,\r\n smooth,\r\n variant === \"area\",\r\n theme\r\n );\r\n }\r\n case \"pie\": {\r\n return renderPieDonutChart(\r\n series,\r\n layout,\r\n palette,\r\n undefined,\r\n false,\r\n theme\r\n );\r\n }\r\n case \"donut\": {\r\n return renderPieDonutChart(\r\n series,\r\n layout,\r\n palette,\r\n centerLabel,\r\n true,\r\n theme\r\n );\r\n }\r\n default: {\r\n return null;\r\n }\r\n }\r\n};\r\n\r\nconst renderAxisLabels = (\r\n isPieOrDonut: boolean,\r\n xLabel: string | undefined,\r\n yLabel: string | undefined,\r\n chartX: number,\r\n chartW: number,\r\n height: number,\r\n mutedForeground: string\r\n) => (\r\n <>\r\n {!isPieOrDonut && xLabel && (\r\n <SvgText\r\n x={chartX + chartW / 2}\r\n y={height - 2}\r\n fill={mutedForeground}\r\n textAnchor=\"middle\"\r\n style={{ fontSize: 8 }}\r\n >\r\n {xLabel}\r\n </SvgText>\r\n )}\r\n {!isPieOrDonut && yLabel && (\r\n <SvgText\r\n x={2}\r\n y={10}\r\n fill={mutedForeground}\r\n textAnchor=\"start\"\r\n style={{ fontSize: 8 }}\r\n >\r\n {yLabel}\r\n </SvgText>\r\n )}\r\n </>\r\n);\r\n\r\nconst renderTextFallback = (\r\n variant: GraphProps[\"variant\"],\r\n series: GraphSeries[],\r\n layout: ChartLayout,\r\n showValues: boolean,\r\n textColor: string\r\n) => {\r\n if (variant === \"pie\" || variant === \"donut\") {\r\n const data = series[0]?.data ?? [];\r\n const total = data.reduce((sum, point) => sum + point.value, 0) || 1;\r\n const cx = layout.svgW / 2;\r\n const cy = layout.svgH / 2;\r\n const radius = Math.min(layout.svgW, layout.svgH) / 2 - 20;\r\n const labelRadius = radius * 1.18;\r\n let currentAngle = 0;\r\n\r\n return (\r\n <View\r\n style={{\r\n height: layout.svgH,\r\n left: 0,\r\n position: \"absolute\",\r\n top: 0,\r\n width: layout.svgW,\r\n }}\r\n >\r\n {data.map((point, index) => {\r\n const sweep = (point.value / total) * 360;\r\n const midAngle = currentAngle + sweep / 2;\r\n currentAngle += sweep;\r\n if (sweep <= 15) {\r\n return null;\r\n }\r\n const labelPoint = polarToCartesian(cx, cy, labelRadius, midAngle);\r\n const onRight = labelPoint.x > cx;\r\n return (\r\n <PDFText\r\n key={`fallback-pie-${point.label}-${index}`}\r\n style={{\r\n color: textColor,\r\n fontSize: 7,\r\n left: onRight ? labelPoint.x : labelPoint.x - 60,\r\n lineHeight: 1,\r\n position: \"absolute\",\r\n textAlign: onRight ? \"left\" : \"right\",\r\n top: labelPoint.y - 4,\r\n width: 60,\r\n }}\r\n >\r\n {truncate(point.label, 10)}\r\n </PDFText>\r\n );\r\n })}\r\n </View>\r\n );\r\n }\r\n\r\n const {\r\n chartH,\r\n chartW,\r\n chartX,\r\n chartY,\r\n svgH,\r\n svgW,\r\n xLabels,\r\n yMax,\r\n yMin,\r\n yTicks,\r\n } = layout;\r\n const range = yMax - yMin || 1;\r\n const toY = (value: number) =>\r\n chartY + chartH - ((value - yMin) / range) * chartH;\r\n const labelStyle = {\r\n color: textColor,\r\n fontSize: 7,\r\n lineHeight: 1,\r\n position: \"absolute\" as const,\r\n };\r\n\r\n if (variant === \"horizontal-bar\") {\r\n const labelWidth = 60;\r\n const rowHeight = chartH / Math.max(xLabels.length, 1);\r\n const maxValue = Math.max(\r\n ...series.flatMap((item) => item.data.map((point) => point.value)),\r\n 1\r\n );\r\n\r\n return (\r\n <View\r\n style={{\r\n height: svgH,\r\n left: 0,\r\n position: \"absolute\",\r\n top: 0,\r\n width: svgW,\r\n }}\r\n >\r\n {xLabels.map((label, index) => {\r\n const value = series[0]?.data[index]?.value ?? 0;\r\n const barWidth = (value / maxValue) * (chartW - labelWidth);\r\n return (\r\n <View key={`fallback-horizontal-${label}`}>\r\n <PDFText\r\n style={{\r\n ...labelStyle,\r\n left: chartX,\r\n textAlign: \"right\",\r\n top: chartY + index * rowHeight + rowHeight / 2 - 4,\r\n width: labelWidth - 4,\r\n }}\r\n >\r\n {truncate(label, 14)}\r\n </PDFText>\r\n {showValues ? (\r\n <PDFText\r\n style={{\r\n ...labelStyle,\r\n color: textColor,\r\n fontSize: 6,\r\n left: chartX + labelWidth + barWidth + 3,\r\n top: chartY + index * rowHeight + rowHeight / 2 - 4,\r\n width: 28,\r\n }}\r\n >\r\n {fmtNum(value)}\r\n </PDFText>\r\n ) : null}\r\n </View>\r\n );\r\n })}\r\n </View>\r\n );\r\n }\r\n\r\n const pointX = (index: number) =>\r\n chartX + (index / Math.max(xLabels.length - 1, 1)) * chartW;\r\n const groupWidth = chartW / Math.max(xLabels.length, 1);\r\n const barGap = 2;\r\n const barWidth = Math.max(\r\n (groupWidth - barGap * (series.length + 1)) / Math.max(series.length, 1),\r\n 1\r\n );\r\n\r\n return (\r\n <View\r\n style={{\r\n height: svgH,\r\n left: 0,\r\n position: \"absolute\",\r\n top: 0,\r\n width: svgW,\r\n }}\r\n >\r\n {yTicks.map((tick) => (\r\n <PDFText\r\n key={`fallback-y-${tick}`}\r\n style={{\r\n ...labelStyle,\r\n left: 0,\r\n textAlign: \"right\",\r\n top: toY(tick) - 4,\r\n width: chartX - 4,\r\n }}\r\n >\r\n {fmtNum(tick)}\r\n </PDFText>\r\n ))}\r\n {(variant === \"line\" || variant === \"area\") &&\r\n xLabels.map((label, index) => (\r\n <PDFText\r\n key={`fallback-x-${label}`}\r\n style={{\r\n ...labelStyle,\r\n left: pointX(index) - 12,\r\n textAlign: \"center\",\r\n top: chartY + chartH + 3,\r\n width: 24,\r\n }}\r\n >\r\n {truncate(label, 8)}\r\n </PDFText>\r\n ))}\r\n {variant === \"bar\" &&\r\n showValues &&\r\n xLabels.flatMap((label, categoryIndex) =>\r\n series.map((item, seriesIndex) => {\r\n const value = item.data[categoryIndex]?.value ?? 0;\r\n const left =\r\n chartX +\r\n categoryIndex * groupWidth +\r\n barGap +\r\n seriesIndex * (barWidth + barGap);\r\n return (\r\n <PDFText\r\n key={`fallback-bar-${label}-${item.name}-${seriesIndex}`}\r\n style={{\r\n ...labelStyle,\r\n fontSize: 6,\r\n left,\r\n textAlign: \"center\",\r\n top: toY(value) - 8,\r\n width: barWidth,\r\n }}\r\n >\r\n {fmtNum(value)}\r\n </PDFText>\r\n );\r\n })\r\n )}\r\n </View>\r\n );\r\n};\r\n\r\nconst renderGraphContent = (\r\n title: string | undefined,\r\n subtitle: string | undefined,\r\n chartContent: React.ReactNode,\r\n chartLabels: React.ReactNode,\r\n axisLabels: React.ReactNode,\r\n textFallback: React.ReactNode,\r\n width: number,\r\n height: number,\r\n legend: string,\r\n showLegend: boolean,\r\n isPieOrDonut: boolean,\r\n series: GraphSeries[],\r\n palette: string[],\r\n styles: ReturnType<typeof createGraphStyles>\r\n) => (\r\n <>\r\n {title && <PDFText style={styles.title}>{title}</PDFText>}\r\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\r\n <View style={legend === \"right\" ? styles.chartWithRightLegend : undefined}>\r\n <View style={{ height, position: \"relative\", width }}>\r\n <Svg width={width} height={height}>\r\n {chartContent}\r\n {axisLabels}\r\n </Svg>\r\n {textFallback}\r\n </View>\r\n {showLegend &&\r\n legend === \"right\" &&\r\n Legend({ palette, position: \"right\", series, styles })}\r\n </View>\r\n {chartLabels}\r\n {showLegend &&\r\n legend === \"bottom\" &&\r\n Legend({ palette, position: \"bottom\", series, styles })}\r\n </>\r\n);\r\n\r\nconst renderBarLabels = (\r\n variant: GraphProps[\"variant\"],\r\n series: GraphSeries[],\r\n chartX: number,\r\n chartW: number\r\n) => {\r\n if (variant !== \"bar\") {\r\n return null;\r\n }\r\n\r\n return (\r\n <View\r\n style={{\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n marginLeft: chartX,\r\n width: chartW,\r\n }}\r\n >\r\n {(series[0]?.data ?? []).map((point) => (\r\n <View key={point.label} style={{ alignItems: \"center\", flex: 1 }}>\r\n <PDFText style={{ fontSize: 7 }}>{truncate(point.label, 10)}</PDFText>\r\n </View>\r\n ))}\r\n </View>\r\n );\r\n};\r\n\r\n/**\r\n * PdfGraph — renders bar, horizontal-bar, line, area, pie, and donut charts\r\n * natively inside react-pdf documents using SVG primitives.\r\n *\r\n * No external chart libraries are required or used — all rendering is done via\r\n * react-pdf's built-in SVG support (`<Svg>`, `<Rect>`, `<Path>`, `<Line>`, etc.).\r\n *\r\n * @example Bar chart\r\n * ```tsx\r\n * <PdfGraph\r\n * variant=\"bar\"\r\n * title=\"Monthly Revenue\"\r\n * data={[\r\n * { label: 'Jan', value: 42000 },\r\n * { label: 'Feb', value: 38000 },\r\n * { label: 'Mar', value: 55000 },\r\n * ]}\r\n * />\r\n * ```\r\n *\r\n * @example Donut chart with center label\r\n * ```tsx\r\n * <PdfGraph\r\n * variant=\"donut\"\r\n * data={[\r\n * { label: 'Product A', value: 45 },\r\n * { label: 'Product B', value: 30 },\r\n * { label: 'Other', value: 25 },\r\n * ]}\r\n * centerLabel=\"$1.2M\"\r\n * />\r\n * ```\r\n *\r\n * **Limitations (by design):**\r\n * - No interactivity (PDFs are static)\r\n * - No animations\r\n * - SVG Text inside charts uses SVG font attributes (not react-pdf StyleSheet fonts)\r\n * - For print PDFs use SVG-friendly fonts registered with Font.register()\r\n */\r\nexport const PdfGraph = ({\r\n variant = \"bar\",\r\n data,\r\n title,\r\n subtitle,\r\n xLabel,\r\n yLabel,\r\n width: explicitWidth,\r\n height = 260,\r\n fullWidth = false,\r\n containerPadding = 0,\r\n wrapperPadding = 0,\r\n colors,\r\n showValues = false,\r\n showGrid = true,\r\n legend = \"bottom\",\r\n centerLabel,\r\n showDots = true,\r\n smooth = false,\r\n yTicks: yTickCount = 5,\r\n noWrap = true,\r\n style,\r\n}: GraphProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createGraphStyles(theme), [theme]);\r\n const palette = colors ?? getDefaultPalette(theme);\r\n const series = normalizeData(data);\r\n\r\n const width = useSafeMemo(() => {\r\n if (fullWidth) {\r\n return getGraphWidth(theme, { containerPadding, wrapperPadding });\r\n }\r\n return explicitWidth ?? GRAPH_SAFE_WIDTHS.default;\r\n }, [fullWidth, explicitWidth, theme, containerPadding, wrapperPadding]);\r\n\r\n const isPieOrDonut = variant === \"pie\" || variant === \"donut\";\r\n const layout = buildLayout(series, width, height, isPieOrDonut, yTickCount);\r\n const { chartX, chartW } = layout;\r\n\r\n const chartContent = renderChartContent(\r\n variant,\r\n series,\r\n layout,\r\n palette,\r\n showGrid,\r\n showValues,\r\n showDots,\r\n smooth,\r\n centerLabel,\r\n theme\r\n );\r\n\r\n const showLegend = legend !== \"none\" && !isPieOrDonut;\r\n const chartLabels = renderBarLabels(variant, series, chartX, chartW);\r\n\r\n const containerStyles: Style[] = [styles.container];\r\n if (style) {\r\n containerStyles.push(style);\r\n }\r\n\r\n const content = (\r\n <View style={containerStyles}>\r\n {renderGraphContent(\r\n title,\r\n subtitle,\r\n chartContent,\r\n chartLabels,\r\n renderAxisLabels(\r\n isPieOrDonut,\r\n xLabel,\r\n yLabel,\r\n chartX,\r\n chartW,\r\n height,\r\n theme.colors.mutedForeground\r\n ),\r\n renderTextFallback(\r\n variant,\r\n series,\r\n layout,\r\n showValues,\r\n theme.colors.mutedForeground\r\n ),\r\n width,\r\n height,\r\n legend,\r\n showLegend,\r\n isPieOrDonut,\r\n series,\r\n palette,\r\n styles\r\n )}\r\n </View>\r\n );\r\n\r\n return noWrap ? (\r\n <View style={[{ breakInside: \"avoid\" as const }].filter(Boolean)}>\r\n {content}\r\n </View>\r\n ) : (\r\n content\r\n );\r\n};\r\n",
+ "content": "import type React from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n Text as PDFText,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport {\n Circle,\n G,\n Line,\n Path,\n Rect,\n Svg,\n SvgText,\n} from \"@/lib/pdf-svg\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport { createGraphStyles } from \"./graph.styles\";\nimport type { ChartLayout, GraphProps, GraphSeries } from \"./graph.types\";\nimport {\n GRAPH_SAFE_WIDTHS,\n arcPath,\n buildLayout,\n fmtNum,\n getDefaultPalette,\n getGraphWidth,\n normalizeData,\n polarToCartesian,\n smoothPath,\n truncate,\n} from \"./graph.utils\";\n\n/**\n * Shared Y-axis grid lines and tick labels for cartesian charts (bar, line, area).\n * Extracted to avoid duplicating the identical block across render functions.\n */\nconst renderGridAndYAxis = (\n ticks: number[],\n toY: (v: number) => number,\n chartX: number,\n chartW: number,\n showGrid: boolean,\n gridColor: string,\n textColor: string\n) => (\n <>\n {ticks.map((tick) => {\n const ty = toY(tick);\n return (\n <G key={`grid-${tick}`}>\n {showGrid && (\n <Line\n x1={chartX}\n y1={ty}\n x2={chartX + chartW}\n y2={ty}\n stroke={gridColor}\n strokeWidth={0.5}\n strokeDasharray=\"3 3\"\n />\n )}\n <SvgText\n x={chartX - 4}\n y={ty + 3}\n fill={textColor}\n textAnchor=\"end\"\n style={{ fontSize: 7 }}\n >\n {fmtNum(tick)}\n </SvgText>\n </G>\n );\n })}\n </>\n);\n\nconst renderBarChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showGrid: boolean,\n showValues: boolean,\n theme: PdfcnTheme\n) => {\n const { chartX, chartY, chartW, chartH, yMin, yMax, yTicks, xLabels } =\n layout;\n const nCategories = xLabels.length;\n const nSeries = series.length;\n const groupGap = 0.25;\n const groupW = chartW / nCategories;\n const barW = (groupW * (1 - groupGap)) / nSeries;\n const textColor = theme.colors.mutedForeground;\n const gridColor = theme.colors.border;\n const axisColor = theme.colors.foreground;\n const range = yMax - yMin || 1;\n const toY = (v: number) => chartY + chartH - ((v - yMin) / range) * chartH;\n\n return (\n <>\n {renderGridAndYAxis(\n yTicks,\n toY,\n chartX,\n chartW,\n showGrid,\n gridColor,\n textColor\n )}\n\n <Line\n x1={chartX}\n y1={chartY + chartH}\n x2={chartX + chartW}\n y2={chartY + chartH}\n stroke={axisColor}\n strokeWidth={1}\n />\n\n {xLabels.map((label, ci) => {\n const groupLeft = chartX + ci * groupW + groupW * (groupGap / 2);\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`group-${ci}`}>\n {series.map((s, si) => {\n const val = s.data[ci]?.value ?? 0;\n const color =\n s.data[ci]?.color ?? s.color ?? palette[si % palette.length];\n const barH = ((val - yMin) / range) * chartH;\n const bx = groupLeft + si * barW;\n const by = chartY + chartH - barH;\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`bar-${ci}-${si}`}>\n <Rect\n x={bx}\n y={by}\n width={barW - 1}\n height={barH}\n fill={color}\n />\n {showValues && barH > 10 && (\n <SvgText\n x={bx + barW / 2 - 0.5}\n y={by - 2}\n fill={axisColor}\n textAnchor=\"middle\"\n style={{ fontSize: 6 }}\n >\n {fmtNum(val)}\n </SvgText>\n )}\n </G>\n );\n })}\n <SvgText\n x={groupLeft + (nSeries * barW) / 2}\n y={chartY + chartH + 10}\n fill={textColor}\n textAnchor=\"middle\"\n style={{ fontSize: 7 }}\n >\n {truncate(label, 10)}\n </SvgText>\n </G>\n );\n })}\n </>\n );\n};\n\nconst renderHorizontalBarChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showValues: boolean,\n theme: PdfcnTheme\n) => {\n const { chartX, chartY, chartW, chartH, xLabels } = layout;\n const nCategories = xLabels.length;\n const allValues = series.flatMap((s) => s.data.map((d) => d.value));\n const maxVal = Math.max(...allValues, 1);\n const rowH = chartH / nCategories;\n const barH = rowH * 0.5;\n const textColor = theme.colors.mutedForeground;\n const axisColor = theme.colors.foreground;\n const labelW = 60;\n\n return (\n <>\n {xLabels.map((label, ci) => {\n const rowY = chartY + ci * rowH;\n const val = series[0]?.data[ci]?.value ?? 0;\n const color =\n series[0]?.data[ci]?.color ??\n series[0]?.color ??\n palette[ci % palette.length];\n const barW = (val / maxVal) * (chartW - labelW);\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`hbar-${ci}`}>\n <SvgText\n x={chartX + labelW - 4}\n y={rowY + rowH / 2 + 3}\n fill={textColor}\n textAnchor=\"end\"\n style={{ fontSize: 7 }}\n >\n {truncate(label, 14)}\n </SvgText>\n <Rect\n x={chartX + labelW}\n y={rowY + (rowH - barH) / 2}\n width={Math.max(barW, 1)}\n height={barH}\n fill={color}\n />\n {showValues && (\n <SvgText\n x={chartX + labelW + barW + 3}\n y={rowY + rowH / 2 + 3}\n fill={axisColor}\n textAnchor=\"start\"\n style={{ fontSize: 6 }}\n >\n {fmtNum(val)}\n </SvgText>\n )}\n </G>\n );\n })}\n <Line\n x1={chartX + labelW}\n y1={chartY}\n x2={chartX + labelW}\n y2={chartY + chartH}\n stroke={axisColor}\n strokeWidth={1}\n />\n </>\n );\n};\n\nconst renderLineAreaChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showGrid: boolean,\n showValues: boolean,\n showDots: boolean,\n smooth: boolean,\n isArea: boolean,\n theme: PdfcnTheme\n) => {\n const { chartX, chartY, chartW, chartH, yMin, yMax, yTicks, xLabels } =\n layout;\n const range = yMax - yMin || 1;\n const textColor = theme.colors.mutedForeground;\n const gridColor = theme.colors.border;\n const axisColor = theme.colors.foreground;\n const nPoints = xLabels.length;\n\n const xFor = (i: number) => chartX + (i / Math.max(nPoints - 1, 1)) * chartW;\n const yFor = (v: number) => chartY + chartH - ((v - yMin) / range) * chartH;\n\n return (\n <>\n {renderGridAndYAxis(\n yTicks,\n yFor,\n chartX,\n chartW,\n showGrid,\n gridColor,\n textColor\n )}\n\n <Line\n x1={chartX}\n y1={chartY + chartH}\n x2={chartX + chartW}\n y2={chartY + chartH}\n stroke={axisColor}\n strokeWidth={1}\n />\n\n {series.map((s, si) => {\n const color = s.color ?? palette[si % palette.length];\n const points = s.data.map((d, i) => ({ x: xFor(i), y: yFor(d.value) }));\n\n const lineDStr = smooth\n ? smoothPath(points)\n : `M ${points.map((p) => `${p.x} ${p.y}`).join(\" L \")}`;\n\n const lastPoint = points.at(-1);\n const firstPoint = points.at(0);\n const areaPath =\n isArea && points.length > 1 && lastPoint && firstPoint\n ? `${lineDStr} L ${lastPoint.x} ${chartY + chartH} L ${firstPoint.x} ${chartY + chartH} Z`\n : null;\n\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`series-${si}`}>\n {isArea && areaPath && (\n <Path d={areaPath} fill={color} fillOpacity={0.2} stroke=\"none\" />\n )}\n <Path d={lineDStr} stroke={color} strokeWidth={2} fill=\"none\" />\n {showDots &&\n points.map((p, pi) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <Circle\n key={`dot-${pi}`}\n cx={p.x}\n cy={p.y}\n r={3}\n fill={color}\n />\n ))}\n {showValues &&\n points.map((p, pi) => (\n <SvgText\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n key={`val-${pi}`}\n x={p.x}\n y={p.y - 5}\n fill={color}\n textAnchor=\"middle\"\n style={{ fontSize: 6 }}\n >\n {fmtNum(s.data[pi].value)}\n </SvgText>\n ))}\n </G>\n );\n })}\n\n {xLabels.map((label, i) => (\n <SvgText\n key={`xlabel-${label}`}\n x={xFor(i)}\n y={chartY + chartH + 10}\n fill={textColor}\n textAnchor=\"middle\"\n style={{ fontSize: 7 }}\n >\n {truncate(label, 8)}\n </SvgText>\n ))}\n </>\n );\n};\n\nconst renderPieDonutChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n centerLabel: string | undefined,\n isDonut: boolean,\n theme: PdfcnTheme\n) => {\n const { svgW, svgH } = layout;\n const cx = svgW / 2;\n const cy = svgH / 2;\n const r = Math.min(svgW, svgH) / 2 - 20;\n const innerR = isDonut ? r * 0.52 : 0;\n const textColor = theme.colors.mutedForeground;\n\n const data = series[0]?.data ?? [];\n const total = data.reduce((sum, d) => sum + d.value, 0) || 1;\n\n let currentAngle = 0;\n\n return (\n <>\n {data.map((d, i) => {\n const color = d.color ?? palette[i % palette.length];\n const sweep = (d.value / total) * 360;\n const midAngle = currentAngle + sweep / 2;\n const path = arcPath(\n cx,\n cy,\n r,\n currentAngle,\n currentAngle + sweep,\n innerR\n );\n currentAngle += sweep;\n\n const labelR = r * 1.18;\n const lp = polarToCartesian(cx, cy, labelR, midAngle);\n const anchor = lp.x > cx ? \"start\" : \"end\";\n\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`slice-${i}`}>\n <Path d={path} fill={color} stroke=\"white\" strokeWidth={1} />\n {/* Show label only if slice is large enough to label */}\n {sweep > 15 && (\n <SvgText\n x={lp.x}\n y={lp.y + 3}\n fill={textColor}\n textAnchor={anchor}\n style={{ fontSize: 7 }}\n >\n {truncate(d.label, 10)}\n </SvgText>\n )}\n </G>\n );\n })}\n\n {isDonut && centerLabel && (\n <>\n <Circle cx={cx} cy={cy} r={innerR} fill=\"white\" />\n <SvgText\n x={cx}\n y={cy + 4}\n fill={theme.colors.foreground}\n textAnchor=\"middle\"\n style={{ fontSize: 9, fontWeight: \"bold\" }}\n >\n {centerLabel}\n </SvgText>\n </>\n )}\n </>\n );\n};\n\nconst Legend = ({\n series,\n palette,\n styles,\n position = \"bottom\",\n}: {\n series: GraphSeries[];\n palette: string[];\n styles: ReturnType<typeof createGraphStyles>;\n position?: \"bottom\" | \"right\";\n}) => {\n const containerStyle =\n position === \"right\" ? styles.legendColumn : styles.legendRow;\n\n return (\n <View style={containerStyle}>\n {series.map((s, i) => (\n <View key={s.name} style={styles.legendItem}>\n <Svg width={10} height={10}>\n <Rect\n x={0}\n y={2}\n width={8}\n height={8}\n fill={s.color ?? palette[i % palette.length]}\n />\n </Svg>\n <PDFText style={styles.legendText}>{s.name}</PDFText>\n </View>\n ))}\n </View>\n );\n};\n\nconst renderChartContent = (\n variant: string,\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showGrid: boolean,\n showValues: boolean,\n showDots: boolean,\n smooth: boolean,\n centerLabel: string | undefined,\n theme: PdfcnTheme\n): React.ReactNode => {\n switch (variant) {\n case \"bar\": {\n return renderBarChart(\n series,\n layout,\n palette,\n showGrid,\n showValues,\n theme\n );\n }\n case \"horizontal-bar\": {\n return renderHorizontalBarChart(\n series,\n layout,\n palette,\n showValues,\n theme\n );\n }\n case \"line\":\n case \"area\": {\n return renderLineAreaChart(\n series,\n layout,\n palette,\n showGrid,\n showValues,\n showDots,\n smooth,\n variant === \"area\",\n theme\n );\n }\n case \"pie\": {\n return renderPieDonutChart(\n series,\n layout,\n palette,\n undefined,\n false,\n theme\n );\n }\n case \"donut\": {\n return renderPieDonutChart(\n series,\n layout,\n palette,\n centerLabel,\n true,\n theme\n );\n }\n default: {\n return null;\n }\n }\n};\n\nconst renderAxisLabels = (\n isPieOrDonut: boolean,\n xLabel: string | undefined,\n yLabel: string | undefined,\n chartX: number,\n chartW: number,\n height: number,\n mutedForeground: string\n) => (\n <>\n {!isPieOrDonut && xLabel && (\n <SvgText\n x={chartX + chartW / 2}\n y={height - 2}\n fill={mutedForeground}\n textAnchor=\"middle\"\n style={{ fontSize: 8 }}\n >\n {xLabel}\n </SvgText>\n )}\n {!isPieOrDonut && yLabel && (\n <SvgText\n x={2}\n y={10}\n fill={mutedForeground}\n textAnchor=\"start\"\n style={{ fontSize: 8 }}\n >\n {yLabel}\n </SvgText>\n )}\n </>\n);\n\nconst renderTextFallback = (\n variant: GraphProps[\"variant\"],\n series: GraphSeries[],\n layout: ChartLayout,\n showValues: boolean,\n textColor: string\n) => {\n if (variant === \"pie\" || variant === \"donut\") {\n const data = series[0]?.data ?? [];\n const total = data.reduce((sum, point) => sum + point.value, 0) || 1;\n const cx = layout.svgW / 2;\n const cy = layout.svgH / 2;\n const radius = Math.min(layout.svgW, layout.svgH) / 2 - 20;\n const labelRadius = radius * 1.18;\n let currentAngle = 0;\n\n return (\n <View\n style={{\n height: layout.svgH,\n left: 0,\n position: \"absolute\",\n top: 0,\n width: layout.svgW,\n }}\n >\n {data.map((point, index) => {\n const sweep = (point.value / total) * 360;\n const midAngle = currentAngle + sweep / 2;\n currentAngle += sweep;\n if (sweep <= 15) {\n return null;\n }\n const labelPoint = polarToCartesian(cx, cy, labelRadius, midAngle);\n const onRight = labelPoint.x > cx;\n return (\n <PDFText\n key={`fallback-pie-${point.label}-${index}`}\n style={{\n color: textColor,\n fontSize: 7,\n left: onRight ? labelPoint.x : labelPoint.x - 60,\n lineHeight: 1,\n position: \"absolute\",\n textAlign: onRight ? \"left\" : \"right\",\n top: labelPoint.y - 4,\n width: 60,\n }}\n >\n {truncate(point.label, 10)}\n </PDFText>\n );\n })}\n </View>\n );\n }\n\n const {\n chartH,\n chartW,\n chartX,\n chartY,\n svgH,\n svgW,\n xLabels,\n yMax,\n yMin,\n yTicks,\n } = layout;\n const range = yMax - yMin || 1;\n const toY = (value: number) =>\n chartY + chartH - ((value - yMin) / range) * chartH;\n const labelStyle = {\n color: textColor,\n fontSize: 7,\n lineHeight: 1,\n position: \"absolute\" as const,\n };\n\n if (variant === \"horizontal-bar\") {\n const labelWidth = 60;\n const rowHeight = chartH / Math.max(xLabels.length, 1);\n const maxValue = Math.max(\n ...series.flatMap((item) => item.data.map((point) => point.value)),\n 1\n );\n\n return (\n <View\n style={{\n height: svgH,\n left: 0,\n position: \"absolute\",\n top: 0,\n width: svgW,\n }}\n >\n {xLabels.map((label, index) => {\n const value = series[0]?.data[index]?.value ?? 0;\n const barWidth = (value / maxValue) * (chartW - labelWidth);\n return (\n <View key={`fallback-horizontal-${label}`}>\n <PDFText\n style={{\n ...labelStyle,\n left: chartX,\n textAlign: \"right\",\n top: chartY + index * rowHeight + rowHeight / 2 - 4,\n width: labelWidth - 4,\n }}\n >\n {truncate(label, 14)}\n </PDFText>\n {showValues ? (\n <PDFText\n style={{\n ...labelStyle,\n color: textColor,\n fontSize: 6,\n left: chartX + labelWidth + barWidth + 3,\n top: chartY + index * rowHeight + rowHeight / 2 - 4,\n width: 28,\n }}\n >\n {fmtNum(value)}\n </PDFText>\n ) : null}\n </View>\n );\n })}\n </View>\n );\n }\n\n const pointX = (index: number) =>\n chartX + (index / Math.max(xLabels.length - 1, 1)) * chartW;\n const groupWidth = chartW / Math.max(xLabels.length, 1);\n const barGap = 2;\n const barWidth = Math.max(\n (groupWidth - barGap * (series.length + 1)) / Math.max(series.length, 1),\n 1\n );\n\n return (\n <View\n style={{\n height: svgH,\n left: 0,\n position: \"absolute\",\n top: 0,\n width: svgW,\n }}\n >\n {yTicks.map((tick) => (\n <PDFText\n key={`fallback-y-${tick}`}\n style={{\n ...labelStyle,\n left: 0,\n textAlign: \"right\",\n top: toY(tick) - 4,\n width: chartX - 4,\n }}\n >\n {fmtNum(tick)}\n </PDFText>\n ))}\n {(variant === \"line\" || variant === \"area\") &&\n xLabels.map((label, index) => (\n <PDFText\n key={`fallback-x-${label}`}\n style={{\n ...labelStyle,\n left: pointX(index) - 12,\n textAlign: \"center\",\n top: chartY + chartH + 3,\n width: 24,\n }}\n >\n {truncate(label, 8)}\n </PDFText>\n ))}\n {variant === \"bar\" &&\n showValues &&\n xLabels.flatMap((label, categoryIndex) =>\n series.map((item, seriesIndex) => {\n const value = item.data[categoryIndex]?.value ?? 0;\n const left =\n chartX +\n categoryIndex * groupWidth +\n barGap +\n seriesIndex * (barWidth + barGap);\n return (\n <PDFText\n key={`fallback-bar-${label}-${item.name}-${seriesIndex}`}\n style={{\n ...labelStyle,\n fontSize: 6,\n left,\n textAlign: \"center\",\n top: toY(value) - 8,\n width: barWidth,\n }}\n >\n {fmtNum(value)}\n </PDFText>\n );\n })\n )}\n </View>\n );\n};\n\nconst renderGraphContent = (\n title: string | undefined,\n subtitle: string | undefined,\n chartContent: React.ReactNode,\n chartLabels: React.ReactNode,\n axisLabels: React.ReactNode,\n textFallback: React.ReactNode,\n width: number,\n height: number,\n legend: string,\n showLegend: boolean,\n isPieOrDonut: boolean,\n series: GraphSeries[],\n palette: string[],\n styles: ReturnType<typeof createGraphStyles>\n) => (\n <>\n {title && <PDFText style={styles.title}>{title}</PDFText>}\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n <View style={legend === \"right\" ? styles.chartWithRightLegend : undefined}>\n <View style={{ height, position: \"relative\", width }}>\n <Svg width={width} height={height}>\n {chartContent}\n {axisLabels}\n </Svg>\n {textFallback}\n </View>\n {showLegend &&\n legend === \"right\" &&\n Legend({ palette, position: \"right\", series, styles })}\n </View>\n {chartLabels}\n {showLegend &&\n legend === \"bottom\" &&\n Legend({ palette, position: \"bottom\", series, styles })}\n </>\n);\n\nconst renderBarLabels = (\n variant: GraphProps[\"variant\"],\n series: GraphSeries[],\n chartX: number,\n chartW: number\n) => {\n if (variant !== \"bar\") {\n return null;\n }\n\n return (\n <View\n style={{\n display: \"flex\",\n flexDirection: \"row\",\n marginLeft: chartX,\n width: chartW,\n }}\n >\n {(series[0]?.data ?? []).map((point) => (\n <View key={point.label} style={{ alignItems: \"center\", flex: 1 }}>\n <PDFText style={{ fontSize: 7 }}>{truncate(point.label, 10)}</PDFText>\n </View>\n ))}\n </View>\n );\n};\n\n/**\n * PdfGraph — renders bar, horizontal-bar, line, area, pie, and donut charts\n * natively inside react-pdf documents using SVG primitives.\n *\n * No external chart libraries are required or used — all rendering is done via\n * react-pdf's built-in SVG support (`<Svg>`, `<Rect>`, `<Path>`, `<Line>`, etc.).\n *\n * @example Bar chart\n * ```tsx\n * <PdfGraph\n * variant=\"bar\"\n * title=\"Monthly Revenue\"\n * data={[\n * { label: 'Jan', value: 42000 },\n * { label: 'Feb', value: 38000 },\n * { label: 'Mar', value: 55000 },\n * ]}\n * />\n * ```\n *\n * @example Donut chart with center label\n * ```tsx\n * <PdfGraph\n * variant=\"donut\"\n * data={[\n * { label: 'Product A', value: 45 },\n * { label: 'Product B', value: 30 },\n * { label: 'Other', value: 25 },\n * ]}\n * centerLabel=\"$1.2M\"\n * />\n * ```\n *\n * **Limitations (by design):**\n * - No interactivity (PDFs are static)\n * - No animations\n * - SVG Text inside charts uses SVG font attributes (not react-pdf StyleSheet fonts)\n * - For print PDFs use SVG-friendly fonts registered with Font.register()\n */\nexport const PdfGraph = ({\n variant = \"bar\",\n data,\n title,\n subtitle,\n xLabel,\n yLabel,\n width: explicitWidth,\n height = 260,\n fullWidth = false,\n containerPadding = 0,\n wrapperPadding = 0,\n colors,\n showValues = false,\n showGrid = true,\n legend = \"bottom\",\n centerLabel,\n showDots = true,\n smooth = false,\n yTicks: yTickCount = 5,\n noWrap = true,\n style,\n}: GraphProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createGraphStyles(theme), [theme]);\n const palette = colors ?? getDefaultPalette(theme);\n const series = normalizeData(data);\n\n const width = useSafeMemo(() => {\n if (fullWidth) {\n return getGraphWidth(theme, { containerPadding, wrapperPadding });\n }\n return explicitWidth ?? GRAPH_SAFE_WIDTHS.default;\n }, [fullWidth, explicitWidth, theme, containerPadding, wrapperPadding]);\n\n const isPieOrDonut = variant === \"pie\" || variant === \"donut\";\n const layout = buildLayout(series, width, height, isPieOrDonut, yTickCount);\n const { chartX, chartW } = layout;\n\n const chartContent = renderChartContent(\n variant,\n series,\n layout,\n palette,\n showGrid,\n showValues,\n showDots,\n smooth,\n centerLabel,\n theme\n );\n\n const showLegend = legend !== \"none\" && !isPieOrDonut;\n const chartLabels = renderBarLabels(variant, series, chartX, chartW);\n\n const containerStyles: Style[] = [styles.container];\n if (style) {\n containerStyles.push(style);\n }\n\n const content = (\n <View style={containerStyles}>\n {renderGraphContent(\n title,\n subtitle,\n chartContent,\n chartLabels,\n renderAxisLabels(\n isPieOrDonut,\n xLabel,\n yLabel,\n chartX,\n chartW,\n height,\n theme.colors.mutedForeground\n ),\n renderTextFallback(\n variant,\n series,\n layout,\n showValues,\n theme.colors.mutedForeground\n ),\n width,\n height,\n legend,\n showLegend,\n isPieOrDonut,\n series,\n palette,\n styles\n )}\n </View>\n );\n\n return noWrap ? (\n <View style={[{ breakInside: \"avoid\" as const }].filter(Boolean)}>\n {content}\n </View>\n ) : (\n content\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/graph/graph.tsx"
},
{
"path": "registry/bases/takumi/components/graph/graph.types.ts",
- "content": "import type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\n\r\n/**\r\n * Options for calculating graph width based on theme page margins and container context.\r\n * Props - `containerPadding` | `wrapperPadding` | `pageWidth`\r\n * @see {@link GraphWidthOptions}\r\n */\r\nexport interface GraphWidthOptions {\r\n containerPadding?: number;\r\n wrapperPadding?: number;\r\n pageWidth?: number;\r\n}\r\n\r\nexport type GraphVariant =\r\n | \"bar\"\r\n | \"horizontal-bar\"\r\n | \"line\"\r\n | \"area\"\r\n | \"pie\"\r\n | \"donut\";\r\n\r\nexport type GraphLegendPosition = \"bottom\" | \"right\" | \"none\";\r\n\r\n/**\r\n * A single data point with a label, numeric value, and optional color override.\r\n * Props - `label` | `value` | `color`\r\n * @see {@link GraphDataPoint}\r\n */\r\nexport interface GraphDataPoint {\r\n label: string;\r\n value: number;\r\n color?: string;\r\n}\r\n\r\n/**\r\n * A named data series containing multiple data points, used for multi-series charts.\r\n * Props - `name` | `data` | `color`\r\n * @see {@link GraphSeries}\r\n */\r\nexport interface GraphSeries {\r\n name: string;\r\n data: GraphDataPoint[];\r\n color?: string;\r\n}\r\n\r\n/**\r\n * Multi-variant PDF chart (bar, line, area, pie, donut) rendered with SVG primitives.\r\n * Props - `variant` | `data` | `title` | `subtitle` | `xLabel` | `yLabel` | `width` | `height` | `fullWidth` | `containerPadding` | `wrapperPadding` | `colors` | `showValues` | `showGrid` | `legend` | `centerLabel` | `showDots` | `smooth` | `yTicks` | `noWrap` | `style`\r\n * @see {@link GraphProps}\r\n */\r\nexport interface GraphProps {\r\n /**\r\n * @default 'bar'\r\n */\r\n variant?: GraphVariant;\r\n data: GraphDataPoint[] | GraphSeries[];\r\n title?: string;\r\n subtitle?: string;\r\n xLabel?: string;\r\n yLabel?: string;\r\n /**\r\n * @default 420\r\n */\r\n width?: number;\r\n /**\r\n * @default 260\r\n */\r\n height?: number;\r\n /**\r\n * @default false\r\n */\r\n fullWidth?: boolean;\r\n containerPadding?: number;\r\n wrapperPadding?: number;\r\n colors?: string[];\r\n /**\r\n * @default false\r\n */\r\n showValues?: boolean;\r\n /**\r\n * @default true\r\n */\r\n showGrid?: boolean;\r\n /**\r\n * @default 'bottom'\r\n */\r\n legend?: GraphLegendPosition;\r\n centerLabel?: string;\r\n /**\r\n * @default true\r\n */\r\n showDots?: boolean;\r\n /**\r\n * @default false\r\n */\r\n smooth?: boolean;\r\n /**\r\n * @default 5\r\n */\r\n yTicks?: number;\r\n /**\r\n * @default true\r\n */\r\n noWrap?: boolean;\r\n style?: Style;\r\n}\r\n\r\n/** Internal chart layout dimensions computed from props and data. */\r\nexport interface ChartLayout {\r\n svgW: number;\r\n svgH: number;\r\n chartX: number;\r\n chartY: number;\r\n chartW: number;\r\n chartH: number;\r\n yMin: number;\r\n yMax: number;\r\n yTicks: number[];\r\n xLabels: string[];\r\n}\r\n",
+ "content": "import type { Style } from \"@/lib/pdf-primitives\";\n\n/**\n * Options for calculating graph width based on theme page margins and container context.\n * Props - `containerPadding` | `wrapperPadding` | `pageWidth`\n * @see {@link GraphWidthOptions}\n */\nexport interface GraphWidthOptions {\n containerPadding?: number;\n wrapperPadding?: number;\n pageWidth?: number;\n}\n\nexport type GraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\nexport type GraphLegendPosition = \"bottom\" | \"right\" | \"none\";\n\n/**\n * A single data point with a label, numeric value, and optional color override.\n * Props - `label` | `value` | `color`\n * @see {@link GraphDataPoint}\n */\nexport interface GraphDataPoint {\n label: string;\n value: number;\n color?: string;\n}\n\n/**\n * A named data series containing multiple data points, used for multi-series charts.\n * Props - `name` | `data` | `color`\n * @see {@link GraphSeries}\n */\nexport interface GraphSeries {\n name: string;\n data: GraphDataPoint[];\n color?: string;\n}\n\n/**\n * Multi-variant PDF chart (bar, line, area, pie, donut) rendered with SVG primitives.\n * Props - `variant` | `data` | `title` | `subtitle` | `xLabel` | `yLabel` | `width` | `height` | `fullWidth` | `containerPadding` | `wrapperPadding` | `colors` | `showValues` | `showGrid` | `legend` | `centerLabel` | `showDots` | `smooth` | `yTicks` | `noWrap` | `style`\n * @see {@link GraphProps}\n */\nexport interface GraphProps {\n /**\n * @default 'bar'\n */\n variant?: GraphVariant;\n data: GraphDataPoint[] | GraphSeries[];\n title?: string;\n subtitle?: string;\n xLabel?: string;\n yLabel?: string;\n /**\n * @default 420\n */\n width?: number;\n /**\n * @default 260\n */\n height?: number;\n /**\n * @default false\n */\n fullWidth?: boolean;\n containerPadding?: number;\n wrapperPadding?: number;\n colors?: string[];\n /**\n * @default false\n */\n showValues?: boolean;\n /**\n * @default true\n */\n showGrid?: boolean;\n /**\n * @default 'bottom'\n */\n legend?: GraphLegendPosition;\n centerLabel?: string;\n /**\n * @default true\n */\n showDots?: boolean;\n /**\n * @default false\n */\n smooth?: boolean;\n /**\n * @default 5\n */\n yTicks?: number;\n /**\n * @default true\n */\n noWrap?: boolean;\n style?: Style;\n}\n\n/** Internal chart layout dimensions computed from props and data. */\nexport interface ChartLayout {\n svgW: number;\n svgH: number;\n chartX: number;\n chartY: number;\n chartW: number;\n chartH: number;\n yMin: number;\n yMax: number;\n yTicks: number[];\n xLabels: string[];\n}\n",
"type": "registry:component",
"target": "components/pdf/graph/graph.types.ts"
},
{
"path": "registry/bases/takumi/components/graph/graph.utils.ts",
- "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type {\r\n ChartLayout,\r\n GraphDataPoint,\r\n GraphSeries,\r\n GraphWidthOptions,\r\n} from \"./graph.types\";\r\n\r\n/** Standard A4 page width in PDF points. */\r\nexport const A4_WIDTH = 595;\r\n\r\n/**\r\n * Pre-calculated safe graph widths for common scenarios.\r\n * These values work with all built-in themes on A4 pages.\r\n */\r\nexport const GRAPH_SAFE_WIDTHS = {\r\n /** Safe width for graph directly in page content (no extra containers) */\r\n default: 420,\r\n /** Safe width for graph inside a Section with md padding */\r\n inSection: 400,\r\n /** Safe width for graph inside a Section + bordered wrapper (like graphShell) */\r\n inSectionWithWrapper: 380,\r\n} as const;\r\n\r\n/**\r\n * Calculate the safe graph width based on theme page margins and container context.\r\n *\r\n * This utility ensures graphs don't overflow their container by accounting for:\r\n * - Page margins (from theme)\r\n * - Container padding (e.g., Section component)\r\n * - Wrapper padding (e.g., a bordered graphShell View)\r\n *\r\n * @example\r\n * ```tsx\r\n * const width = getGraphWidth(theme);\r\n * // For a graph inside a Section with padding=\"md\" (12pt) and a graphShell (12pt):\r\n * const width = getGraphWidth(theme, { containerPadding: 12, wrapperPadding: 12 });\r\n * ```\r\n */\r\nexport const getGraphWidth = (\r\n theme: PdfcnTheme,\r\n options: GraphWidthOptions = {}\r\n): number => {\r\n const {\r\n containerPadding = 0,\r\n wrapperPadding = 0,\r\n pageWidth = A4_WIDTH,\r\n } = options;\r\n const { marginLeft, marginRight } = theme.spacing.page;\r\n const availableWidth =\r\n pageWidth -\r\n marginLeft -\r\n marginRight -\r\n containerPadding * 2 -\r\n wrapperPadding * 2;\r\n return Math.max(Math.floor(availableWidth), 100);\r\n};\r\n\r\nexport const CHART_MARGINS = {\r\n axisBottom: 24,\r\n axisLeft: 40,\r\n pieBottom: 10,\r\n pieLeft: 10,\r\n right: 10,\r\n top: 10,\r\n} as const;\r\n\r\n/** Normalize to always work with GraphSeries[]. */\r\nexport const normalizeData = (\r\n data: GraphDataPoint[] | GraphSeries[]\r\n): GraphSeries[] => {\r\n if (data.length === 0) {\r\n return [];\r\n }\r\n if (\"label\" in data[0] && \"value\" in data[0]) {\r\n return [{ data: data as GraphDataPoint[], name: \"Series 1\" }];\r\n }\r\n return data as GraphSeries[];\r\n};\r\n\r\n/** Compute nice Y-axis ticks for a given value range. */\r\nexport const computeYTicks = (\r\n min: number,\r\n max: number,\r\n count: number\r\n): number[] => {\r\n if (min === max) {\r\n return [0, max || 1];\r\n }\r\n const step = (max - min) / (count - 1);\r\n return Array.from({ length: count }, (_, i) => {\r\n const v = min + i * step;\r\n return Math.round(v * 100) / 100;\r\n });\r\n};\r\n\r\n/** Format a number for display on axis labels. */\r\nexport const fmtNum = (v: number): string => {\r\n if (Math.abs(v) >= 1_000_000) {\r\n return `${(v / 1_000_000).toFixed(1)}M`;\r\n }\r\n if (Math.abs(v) >= 1000) {\r\n return `${(v / 1000).toFixed(1)}K`;\r\n }\r\n if (!Number.isInteger(v)) {\r\n return v.toFixed(1);\r\n }\r\n return String(v);\r\n};\r\n\r\n/** Truncate a label to at most maxLen characters. */\r\nexport const truncate = (s: string, maxLen: number): string =>\r\n s.length > maxLen ? `${s.slice(0, maxLen - 1)}…` : s;\r\n\r\n/** Polar to Cartesian coordinate conversion for pie/donut arcs. */\r\nexport const polarToCartesian = (\r\n cx: number,\r\n cy: number,\r\n r: number,\r\n angleDeg: number\r\n) => {\r\n const rad = ((angleDeg - 90) * Math.PI) / 180;\r\n return { x: cx + r * Math.cos(rad), y: cy + r * Math.sin(rad) };\r\n};\r\n\r\n/** Build an SVG arc path for a pie/donut slice. */\r\nexport const arcPath = (\r\n cx: number,\r\n cy: number,\r\n r: number,\r\n startAngle: number,\r\n endAngle: number,\r\n innerR = 0\r\n): string => {\r\n const safeEnd = Math.min(endAngle, startAngle + 359.999);\r\n const large = safeEnd - startAngle > 180 ? 1 : 0;\r\n const s = polarToCartesian(cx, cy, r, safeEnd);\r\n const e = polarToCartesian(cx, cy, r, startAngle);\r\n if (innerR === 0) {\r\n return `M ${cx} ${cy} L ${s.x} ${s.y} A ${r} ${r} 0 ${large} 0 ${e.x} ${e.y} Z`;\r\n }\r\n const si = polarToCartesian(cx, cy, innerR, safeEnd);\r\n const ei = polarToCartesian(cx, cy, innerR, startAngle);\r\n return [\r\n `M ${s.x} ${s.y}`,\r\n `A ${r} ${r} 0 ${large} 0 ${e.x} ${e.y}`,\r\n `L ${ei.x} ${ei.y}`,\r\n `A ${innerR} ${innerR} 0 ${large} 1 ${si.x} ${si.y}`,\r\n \"Z\",\r\n ].join(\" \");\r\n};\r\n\r\n/** Compute smooth bezier control points (Catmull-Rom → cubic bezier). */\r\nexport const smoothPath = (\r\n points: { x: number; y: number }[],\r\n tension = 0.4\r\n): string => {\r\n if (points.length < 2) {\r\n return \"\";\r\n }\r\n if (points.length === 2) {\r\n return `M ${points[0].x} ${points[0].y} L ${points[1].x} ${points[1].y}`;\r\n }\r\n const parts: string[] = [`M ${points[0].x} ${points[0].y}`];\r\n for (let i = 0; i < points.length - 1; i += 1) {\r\n const p0 = points[Math.max(i - 1, 0)];\r\n const p1 = points[i];\r\n const p2 = points[i + 1];\r\n const p3 = points[Math.min(i + 2, points.length - 1)];\r\n const cp1x = p1.x + (p2.x - p0.x) * tension;\r\n const cp1y = p1.y + (p2.y - p0.y) * tension;\r\n const cp2x = p2.x - (p3.x - p1.x) * tension;\r\n const cp2y = p2.y - (p3.y - p1.y) * tension;\r\n parts.push(`C ${cp1x} ${cp1y} ${cp2x} ${cp2y} ${p2.x} ${p2.y}`);\r\n }\r\n return parts.join(\" \");\r\n};\r\n\r\n/** Get the default chart color palette from the theme. */\r\nexport const getDefaultPalette = (t: PdfcnTheme): string[] => [\r\n t.colors.primary,\r\n t.colors.info ?? \"#3B82F6\",\r\n t.colors.success ?? \"#22C55E\",\r\n t.colors.warning ?? \"#F59E0B\",\r\n t.colors.destructive ?? \"#EF4444\",\r\n \"#8B5CF6\",\r\n \"#F97316\",\r\n \"#14B8A6\",\r\n];\r\n\r\n/** Derive ChartLayout from series data, SVG dimensions, and variant. */\r\nexport const buildLayout = (\r\n series: GraphSeries[],\r\n width: number,\r\n height: number,\r\n isPieOrDonut: boolean,\r\n yTickCount: number\r\n): ChartLayout => {\r\n const mL = isPieOrDonut ? CHART_MARGINS.pieLeft : CHART_MARGINS.axisLeft;\r\n const mB = isPieOrDonut ? CHART_MARGINS.pieBottom : CHART_MARGINS.axisBottom;\r\n const chartX = mL;\r\n const chartY = CHART_MARGINS.top;\r\n const chartW = width - mL - CHART_MARGINS.right;\r\n const chartH = height - CHART_MARGINS.top - mB;\r\n const allValues = series.flatMap((s) => s.data.map((d) => d.value));\r\n const rawMin = Math.min(...allValues, 0);\r\n const rawMax = Math.max(...allValues, 1);\r\n const yMin = Math.min(0, rawMin);\r\n const yMax = rawMax + (rawMax - yMin) * 0.08;\r\n return {\r\n chartH,\r\n chartW,\r\n chartX,\r\n chartY,\r\n svgH: height,\r\n svgW: width,\r\n xLabels: series[0]?.data.map((d) => d.label) ?? [],\r\n yMax,\r\n yMin,\r\n yTicks: computeYTicks(yMin, yMax, yTickCount),\r\n };\r\n};\r\n",
+ "content": "import type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type {\n ChartLayout,\n GraphDataPoint,\n GraphSeries,\n GraphWidthOptions,\n} from \"./graph.types\";\n\n/** Standard A4 page width in PDF points. */\nexport const A4_WIDTH = 595;\n\n/**\n * Pre-calculated safe graph widths for common scenarios.\n * These values work with all built-in themes on A4 pages.\n */\nexport const GRAPH_SAFE_WIDTHS = {\n /** Safe width for graph directly in page content (no extra containers) */\n default: 420,\n /** Safe width for graph inside a Section with md padding */\n inSection: 400,\n /** Safe width for graph inside a Section + bordered wrapper (like graphShell) */\n inSectionWithWrapper: 380,\n} as const;\n\n/**\n * Calculate the safe graph width based on theme page margins and container context.\n *\n * This utility ensures graphs don't overflow their container by accounting for:\n * - Page margins (from theme)\n * - Container padding (e.g., Section component)\n * - Wrapper padding (e.g., a bordered graphShell View)\n *\n * @example\n * ```tsx\n * const width = getGraphWidth(theme);\n * // For a graph inside a Section with padding=\"md\" (12pt) and a graphShell (12pt):\n * const width = getGraphWidth(theme, { containerPadding: 12, wrapperPadding: 12 });\n * ```\n */\nexport const getGraphWidth = (\n theme: PdfcnTheme,\n options: GraphWidthOptions = {}\n): number => {\n const {\n containerPadding = 0,\n wrapperPadding = 0,\n pageWidth = A4_WIDTH,\n } = options;\n const { marginLeft, marginRight } = theme.spacing.page;\n const availableWidth =\n pageWidth -\n marginLeft -\n marginRight -\n containerPadding * 2 -\n wrapperPadding * 2;\n return Math.max(Math.floor(availableWidth), 100);\n};\n\nexport const CHART_MARGINS = {\n axisBottom: 24,\n axisLeft: 40,\n pieBottom: 10,\n pieLeft: 10,\n right: 10,\n top: 10,\n} as const;\n\n/** Normalize to always work with GraphSeries[]. */\nexport const normalizeData = (\n data: GraphDataPoint[] | GraphSeries[]\n): GraphSeries[] => {\n if (data.length === 0) {\n return [];\n }\n if (\"label\" in data[0] && \"value\" in data[0]) {\n return [{ data: data as GraphDataPoint[], name: \"Series 1\" }];\n }\n return data as GraphSeries[];\n};\n\n/** Compute nice Y-axis ticks for a given value range. */\nexport const computeYTicks = (\n min: number,\n max: number,\n count: number\n): number[] => {\n if (min === max) {\n return [0, max || 1];\n }\n const step = (max - min) / (count - 1);\n return Array.from({ length: count }, (_, i) => {\n const v = min + i * step;\n return Math.round(v * 100) / 100;\n });\n};\n\n/** Format a number for display on axis labels. */\nexport const fmtNum = (v: number): string => {\n if (Math.abs(v) >= 1_000_000) {\n return `${(v / 1_000_000).toFixed(1)}M`;\n }\n if (Math.abs(v) >= 1000) {\n return `${(v / 1000).toFixed(1)}K`;\n }\n if (!Number.isInteger(v)) {\n return v.toFixed(1);\n }\n return String(v);\n};\n\n/** Truncate a label to at most maxLen characters. */\nexport const truncate = (s: string, maxLen: number): string =>\n s.length > maxLen ? `${s.slice(0, maxLen - 1)}…` : s;\n\n/** Polar to Cartesian coordinate conversion for pie/donut arcs. */\nexport const polarToCartesian = (\n cx: number,\n cy: number,\n r: number,\n angleDeg: number\n) => {\n const rad = ((angleDeg - 90) * Math.PI) / 180;\n return { x: cx + r * Math.cos(rad), y: cy + r * Math.sin(rad) };\n};\n\n/** Build an SVG arc path for a pie/donut slice. */\nexport const arcPath = (\n cx: number,\n cy: number,\n r: number,\n startAngle: number,\n endAngle: number,\n innerR = 0\n): string => {\n const safeEnd = Math.min(endAngle, startAngle + 359.999);\n const large = safeEnd - startAngle > 180 ? 1 : 0;\n const s = polarToCartesian(cx, cy, r, safeEnd);\n const e = polarToCartesian(cx, cy, r, startAngle);\n if (innerR === 0) {\n return `M ${cx} ${cy} L ${s.x} ${s.y} A ${r} ${r} 0 ${large} 0 ${e.x} ${e.y} Z`;\n }\n const si = polarToCartesian(cx, cy, innerR, safeEnd);\n const ei = polarToCartesian(cx, cy, innerR, startAngle);\n return [\n `M ${s.x} ${s.y}`,\n `A ${r} ${r} 0 ${large} 0 ${e.x} ${e.y}`,\n `L ${ei.x} ${ei.y}`,\n `A ${innerR} ${innerR} 0 ${large} 1 ${si.x} ${si.y}`,\n \"Z\",\n ].join(\" \");\n};\n\n/** Compute smooth bezier control points (Catmull-Rom → cubic bezier). */\nexport const smoothPath = (\n points: { x: number; y: number }[],\n tension = 0.4\n): string => {\n if (points.length < 2) {\n return \"\";\n }\n if (points.length === 2) {\n return `M ${points[0].x} ${points[0].y} L ${points[1].x} ${points[1].y}`;\n }\n const parts: string[] = [`M ${points[0].x} ${points[0].y}`];\n for (let i = 0; i < points.length - 1; i += 1) {\n const p0 = points[Math.max(i - 1, 0)];\n const p1 = points[i];\n const p2 = points[i + 1];\n const p3 = points[Math.min(i + 2, points.length - 1)];\n const cp1x = p1.x + (p2.x - p0.x) * tension;\n const cp1y = p1.y + (p2.y - p0.y) * tension;\n const cp2x = p2.x - (p3.x - p1.x) * tension;\n const cp2y = p2.y - (p3.y - p1.y) * tension;\n parts.push(`C ${cp1x} ${cp1y} ${cp2x} ${cp2y} ${p2.x} ${p2.y}`);\n }\n return parts.join(\" \");\n};\n\n/** Get the default chart color palette from the theme. */\nexport const getDefaultPalette = (t: PdfcnTheme): string[] => [\n t.colors.primary,\n t.colors.info ?? \"#3B82F6\",\n t.colors.success ?? \"#22C55E\",\n t.colors.warning ?? \"#F59E0B\",\n t.colors.destructive ?? \"#EF4444\",\n \"#8B5CF6\",\n \"#F97316\",\n \"#14B8A6\",\n];\n\n/** Derive ChartLayout from series data, SVG dimensions, and variant. */\nexport const buildLayout = (\n series: GraphSeries[],\n width: number,\n height: number,\n isPieOrDonut: boolean,\n yTickCount: number\n): ChartLayout => {\n const mL = isPieOrDonut ? CHART_MARGINS.pieLeft : CHART_MARGINS.axisLeft;\n const mB = isPieOrDonut ? CHART_MARGINS.pieBottom : CHART_MARGINS.axisBottom;\n const chartX = mL;\n const chartY = CHART_MARGINS.top;\n const chartW = width - mL - CHART_MARGINS.right;\n const chartH = height - CHART_MARGINS.top - mB;\n const allValues = series.flatMap((s) => s.data.map((d) => d.value));\n const rawMin = Math.min(...allValues, 0);\n const rawMax = Math.max(...allValues, 1);\n const yMin = Math.min(0, rawMin);\n const yMax = rawMax + (rawMax - yMin) * 0.08;\n return {\n chartH,\n chartW,\n chartX,\n chartY,\n svgH: height,\n svgW: width,\n xLabels: series[0]?.data.map((d) => d.label) ?? [],\n yMax,\n yMin,\n yTicks: computeYTicks(yMin, yMax, yTickCount),\n };\n};\n",
"type": "registry:component",
"target": "components/pdf/graph/graph.utils.ts"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/heading.json b/apps/web/public/r/takumi/heading.json
index cd90f2f..25b9757 100644
--- a/apps/web/public/r/takumi/heading.json
+++ b/apps/web/public/r/takumi/heading.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/takumi/components/heading/heading.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport { Text, StyleSheet } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type HeadingWeight = \"normal\" | \"medium\" | \"semibold\" | \"bold\";\r\nexport type HeadingTracking = \"tighter\" | \"tight\" | \"normal\" | \"wide\" | \"wider\";\r\n\r\n/**\r\n * PDF heading mapped to h1–h6 font sizes from the theme.\r\n * Props - `level` | `align` | `color` | `transform` | `weight` | `tracking` | `noMargin` | `keepWithNext` | `children` | `style`\r\n * @see {@link HeadingProps}\r\n */\r\nexport interface HeadingProps extends PDFComponentProps {\r\n /**\r\n * @default 1\r\n */\r\n level?: 1 | 2 | 3 | 4 | 5 | 6;\r\n /**\r\n * @default 'left'\r\n */\r\n align?: \"left\" | \"center\" | \"right\";\r\n color?: string;\r\n transform?: \"uppercase\" | \"lowercase\" | \"capitalize\";\r\n /**\r\n * @default 'bold'\r\n */\r\n weight?: HeadingWeight;\r\n /**\r\n * @default 'normal'\r\n */\r\n tracking?: HeadingTracking;\r\n /**\r\n * @default false\r\n */\r\n noMargin?: boolean;\r\n keepWithNext?: boolean;\r\n}\r\n\r\nconst createHeadingStyles = (t: PdfcnTheme) => {\r\n const { heading } = t.typography;\r\n const { spacing, fontWeights, letterSpacing } = t.primitives;\r\n const { sectionGap, componentGap, paragraphGap } = t.spacing;\r\n const base = {\r\n color: t.colors.foreground,\r\n fontFamily: heading.fontFamily,\r\n fontWeight: fontWeights.bold,\r\n lineHeight: heading.lineHeight,\r\n };\r\n return StyleSheet.create({\r\n capitalize: { textTransform: \"capitalize\" },\r\n h1: {\r\n ...base,\r\n fontSize: heading.fontSize.h1,\r\n marginBottom: paragraphGap,\r\n marginTop: spacing[0],\r\n },\r\n h2: {\r\n ...base,\r\n fontSize: heading.fontSize.h2,\r\n marginBottom: paragraphGap,\r\n marginTop: sectionGap,\r\n },\r\n h3: {\r\n ...base,\r\n fontSize: heading.fontSize.h3,\r\n marginBottom: paragraphGap,\r\n marginTop: componentGap,\r\n },\r\n h4: {\r\n ...base,\r\n fontSize: heading.fontSize.h4,\r\n marginBottom: paragraphGap,\r\n marginTop: paragraphGap,\r\n },\r\n h5: {\r\n ...base,\r\n fontSize: heading.fontSize.h5,\r\n marginBottom: spacing[1],\r\n marginTop: paragraphGap,\r\n },\r\n h6: {\r\n ...base,\r\n fontSize: heading.fontSize.h6,\r\n marginBottom: spacing[1],\r\n marginTop: paragraphGap,\r\n },\r\n lowercase: { textTransform: \"lowercase\" },\r\n noMargin: { marginBottom: 0, marginTop: 0 },\r\n trackingNormal: { letterSpacing: letterSpacing.normal },\r\n trackingTight: { letterSpacing: letterSpacing.tight * 10 },\r\n trackingTighter: { letterSpacing: letterSpacing.tight * 15 },\r\n trackingWide: { letterSpacing: letterSpacing.wide * 10 },\r\n trackingWider: { letterSpacing: letterSpacing.wider * 10 },\r\n uppercase: {\r\n letterSpacing: letterSpacing.wider * 10,\r\n textTransform: \"uppercase\",\r\n },\r\n weightBold: { fontWeight: fontWeights.bold },\r\n weightMedium: { fontWeight: fontWeights.medium },\r\n weightNormal: { fontWeight: fontWeights.regular },\r\n weightSemibold: { fontWeight: fontWeights.semibold },\r\n });\r\n};\r\n\r\nexport const Heading = ({\r\n level = 1,\r\n align,\r\n color,\r\n transform,\r\n weight,\r\n tracking,\r\n noMargin,\r\n children,\r\n style,\r\n}: HeadingProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createHeadingStyles(theme), [theme]);\r\n const safeLevel = Math.min(Math.max(Math.round(level), 1), 6) as\r\n | 1\r\n | 2\r\n | 3\r\n | 4\r\n | 5\r\n | 6;\r\n const weightMap = {\r\n bold: styles.weightBold,\r\n medium: styles.weightMedium,\r\n normal: styles.weightNormal,\r\n semibold: styles.weightSemibold,\r\n };\r\n const trackingMap = {\r\n normal: styles.trackingNormal,\r\n tight: styles.trackingTight,\r\n tighter: styles.trackingTighter,\r\n wide: styles.trackingWide,\r\n wider: styles.trackingWider,\r\n };\r\n const transformMap = {\r\n capitalize: styles.capitalize,\r\n lowercase: styles.lowercase,\r\n uppercase: styles.uppercase,\r\n };\r\n const styleArray: Style[] = [\r\n styles[`h${safeLevel}` as keyof typeof styles] as Style,\r\n ];\r\n if (weight && weight in weightMap) {\r\n styleArray.push(weightMap[weight]);\r\n }\r\n if (tracking && tracking in trackingMap) {\r\n styleArray.push(trackingMap[tracking]);\r\n }\r\n if (transform && transform in transformMap) {\r\n styleArray.push(transformMap[transform as keyof typeof transformMap]);\r\n }\r\n if (noMargin) {\r\n styleArray.push(styles.noMargin);\r\n }\r\n const semantic = {} as Style;\r\n if (align) {\r\n semantic.textAlign = align;\r\n }\r\n if (color) {\r\n semantic.color = resolveColor(color, theme.colors);\r\n }\r\n if (Object.keys(semantic).length > 0) {\r\n styleArray.push(semantic);\r\n }\r\n if (style) {\r\n styleArray.push(...[style].flat());\r\n }\r\n return <Text style={styleArray}>{children}</Text>;\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport { Text, StyleSheet } from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type HeadingWeight = \"normal\" | \"medium\" | \"semibold\" | \"bold\";\nexport type HeadingTracking = \"tighter\" | \"tight\" | \"normal\" | \"wide\" | \"wider\";\n\n/**\n * PDF heading mapped to h1–h6 font sizes from the theme.\n * Props - `level` | `align` | `color` | `transform` | `weight` | `tracking` | `noMargin` | `keepWithNext` | `children` | `style`\n * @see {@link HeadingProps}\n */\nexport interface HeadingProps extends PDFComponentProps {\n /**\n * @default 1\n */\n level?: 1 | 2 | 3 | 4 | 5 | 6;\n /**\n * @default 'left'\n */\n align?: \"left\" | \"center\" | \"right\";\n color?: string;\n transform?: \"uppercase\" | \"lowercase\" | \"capitalize\";\n /**\n * @default 'bold'\n */\n weight?: HeadingWeight;\n /**\n * @default 'normal'\n */\n tracking?: HeadingTracking;\n /**\n * @default false\n */\n noMargin?: boolean;\n keepWithNext?: boolean;\n}\n\nconst createHeadingStyles = (t: PdfcnTheme) => {\n const { heading } = t.typography;\n const { spacing, fontWeights, letterSpacing } = t.primitives;\n const { sectionGap, componentGap, paragraphGap } = t.spacing;\n const base = {\n color: t.colors.foreground,\n fontFamily: heading.fontFamily,\n fontWeight: fontWeights.bold,\n lineHeight: heading.lineHeight,\n };\n return StyleSheet.create({\n capitalize: { textTransform: \"capitalize\" },\n h1: {\n ...base,\n fontSize: heading.fontSize.h1,\n marginBottom: paragraphGap,\n marginTop: spacing[0],\n },\n h2: {\n ...base,\n fontSize: heading.fontSize.h2,\n marginBottom: paragraphGap,\n marginTop: sectionGap,\n },\n h3: {\n ...base,\n fontSize: heading.fontSize.h3,\n marginBottom: paragraphGap,\n marginTop: componentGap,\n },\n h4: {\n ...base,\n fontSize: heading.fontSize.h4,\n marginBottom: paragraphGap,\n marginTop: paragraphGap,\n },\n h5: {\n ...base,\n fontSize: heading.fontSize.h5,\n marginBottom: spacing[1],\n marginTop: paragraphGap,\n },\n h6: {\n ...base,\n fontSize: heading.fontSize.h6,\n marginBottom: spacing[1],\n marginTop: paragraphGap,\n },\n lowercase: { textTransform: \"lowercase\" },\n noMargin: { marginBottom: 0, marginTop: 0 },\n trackingNormal: { letterSpacing: letterSpacing.normal },\n trackingTight: { letterSpacing: letterSpacing.tight * 10 },\n trackingTighter: { letterSpacing: letterSpacing.tight * 15 },\n trackingWide: { letterSpacing: letterSpacing.wide * 10 },\n trackingWider: { letterSpacing: letterSpacing.wider * 10 },\n uppercase: {\n letterSpacing: letterSpacing.wider * 10,\n textTransform: \"uppercase\",\n },\n weightBold: { fontWeight: fontWeights.bold },\n weightMedium: { fontWeight: fontWeights.medium },\n weightNormal: { fontWeight: fontWeights.regular },\n weightSemibold: { fontWeight: fontWeights.semibold },\n });\n};\n\nexport const Heading = ({\n level = 1,\n align,\n color,\n transform,\n weight,\n tracking,\n noMargin,\n children,\n style,\n}: HeadingProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createHeadingStyles(theme), [theme]);\n const safeLevel = Math.min(Math.max(Math.round(level), 1), 6) as\n | 1\n | 2\n | 3\n | 4\n | 5\n | 6;\n const weightMap = {\n bold: styles.weightBold,\n medium: styles.weightMedium,\n normal: styles.weightNormal,\n semibold: styles.weightSemibold,\n };\n const trackingMap = {\n normal: styles.trackingNormal,\n tight: styles.trackingTight,\n tighter: styles.trackingTighter,\n wide: styles.trackingWide,\n wider: styles.trackingWider,\n };\n const transformMap = {\n capitalize: styles.capitalize,\n lowercase: styles.lowercase,\n uppercase: styles.uppercase,\n };\n const styleArray: Style[] = [\n styles[`h${safeLevel}` as keyof typeof styles] as Style,\n ];\n if (weight && weight in weightMap) {\n styleArray.push(weightMap[weight]);\n }\n if (tracking && tracking in trackingMap) {\n styleArray.push(trackingMap[tracking]);\n }\n if (transform && transform in transformMap) {\n styleArray.push(transformMap[transform as keyof typeof transformMap]);\n }\n if (noMargin) {\n styleArray.push(styles.noMargin);\n }\n const semantic = {} as Style;\n if (align) {\n semantic.textAlign = align;\n }\n if (color) {\n semantic.color = resolveColor(color, theme.colors);\n }\n if (Object.keys(semantic).length > 0) {\n styleArray.push(semantic);\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return <Text style={styleArray}>{children}</Text>;\n};\n",
"type": "registry:component",
"target": "components/pdf/heading/heading.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/invoice-classic.json b/apps/web/public/r/takumi/invoice-classic.json
index dbe034f..90a69ca 100644
--- a/apps/web/public/r/takumi/invoice-classic.json
+++ b/apps/web/public/r/takumi/invoice-classic.json
@@ -20,16 +20,16 @@
"files": [
{
"path": "registry/bases/takumi/blocks/invoice-classic/invoice-classic.tsx",
- "content": "import { KeyValue } from \"@/registry/bases/takumi/components/key-value/key-value\";\r\nimport { PageFooter } from \"@/registry/bases/takumi/components/page-footer/page-footer\";\r\nimport { PageHeader } from \"@/registry/bases/takumi/components/page-header/page-header\";\r\nimport { PdfImage } from \"@/registry/bases/takumi/components/pdf-image/pdf-image\";\r\nimport { Section } from \"@/registry/bases/takumi/components/section/section\";\r\nimport {\r\n Table,\r\n TableBody,\r\n TableCell,\r\n TableHeader,\r\n TableRow,\r\n} from \"@/registry/bases/takumi/components/table/table\";\r\nimport { Text } from \"@/registry/bases/takumi/components/text/text\";\r\nimport {\r\n PdfcnThemeProvider,\r\n usePdfcnTheme,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n StyleSheet,\r\n Document,\r\n Page,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { InvoiceClassicData } from \"./invoice-classic.types\";\r\n\r\n// Sample data — replace with your own props or data source\r\nconst sampleData: InvoiceClassicData = {\r\n billTo: {\r\n address: \"456 Client Ave, Suite 2\",\r\n email: \"[email protected]\",\r\n name: \"Client Corp.\",\r\n phone: \"+1 (555) 123-4567\",\r\n },\r\n companyAddress: \"Nagpur, IN\",\r\n companyEmail: \"[email protected]\",\r\n companyName: \"pdfcn\",\r\n dueDate: \"March 17, 2026\",\r\n invoiceDate: \"February 17, 2026\",\r\n invoiceNumber: \"INV-2026-001\",\r\n items: [\r\n { description: \"Web Development\", quantity: 1, unitPrice: 12_500 },\r\n { description: \"UI/UX Design\", quantity: 1, unitPrice: 8750 },\r\n { description: \"Consulting\", quantity: 10, unitPrice: 1500 },\r\n ],\r\n logo: \"/favicon.png\",\r\n notes: \"Thank you for your business!\",\r\n paymentTerms: {\r\n dueDate: \"March 17, 2026\",\r\n gst: \"GSTIN 123456789\",\r\n method: \"UPI / Card / Bank Transfer\",\r\n },\r\n subtitle: \"Innovative PDF Solutions\",\r\n summary: {\r\n subtotal: 36_250,\r\n tax: 2537.5,\r\n total: 38_787.5,\r\n },\r\n};\r\n\r\nconst InvoiceClassicContent = ({ data }: { data: InvoiceClassicData }) => {\r\n const theme = usePdfcnTheme();\r\n\r\n const styles = StyleSheet.create({\r\n page: {\r\n backgroundColor: theme.colors.background,\r\n boxSizing: \"border-box\",\r\n minHeight: 841,\r\n padding: theme.spacing.page.marginTop,\r\n paddingBottom: theme.spacing.page.marginBottom,\r\n position: \"relative\",\r\n },\r\n });\r\n\r\n return (\r\n <Document title={`Invoice ${data.invoiceNumber}`}>\r\n <Page size=\"A4\" style={styles.page}>\r\n <PageHeader\r\n variant=\"logo-left\"\r\n logo={\r\n <PdfImage src={data.logo ?? \"/favicon.png\"} style={{ margin: 0 }} />\r\n }\r\n title={data.companyName}\r\n subtitle={data.subtitle}\r\n rightText={data.invoiceNumber}\r\n rightSubText={`Due: ${data.dueDate}`}\r\n style={{ marginBottom: 0 }}\r\n />\r\n <Section noWrap style={{ flexDirection: \"row\" }}>\r\n <View style={{ flex: 1, paddingRight: 15 }}>\r\n <Text\r\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\r\n color=\"mutedForeground\"\r\n transform=\"uppercase\"\r\n noMargin\r\n >\r\n From\r\n </Text>\r\n <Text noMargin variant=\"xs\">\r\n {data.companyName}\r\n </Text>\r\n <Text noMargin variant=\"xs\">\r\n {data.companyAddress}\r\n </Text>\r\n <Text noMargin variant=\"xs\">\r\n {data.companyEmail}\r\n </Text>\r\n </View>\r\n <View style={{ flex: 1, paddingRight: 15 }}>\r\n <Text\r\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\r\n color=\"mutedForeground\"\r\n transform=\"uppercase\"\r\n noMargin\r\n >\r\n Bill To\r\n </Text>\r\n <Text noMargin variant=\"xs\">\r\n {data.billTo.name}\r\n </Text>\r\n <Text noMargin variant=\"xs\">\r\n {data.billTo.address}\r\n </Text>\r\n <Text noMargin variant=\"xs\">\r\n {data.billTo.email}\r\n </Text>\r\n </View>\r\n <View style={{ flex: 1, paddingRight: 15 }}>\r\n <Text\r\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\r\n color=\"mutedForeground\"\r\n transform=\"uppercase\"\r\n noMargin\r\n >\r\n Payment Terms\r\n </Text>\r\n <Text noMargin variant=\"xs\">\r\n {data.paymentTerms.method}\r\n </Text>\r\n <Text noMargin variant=\"xs\">\r\n {data.paymentTerms.gst}\r\n </Text>\r\n <Text noMargin variant=\"xs\">\r\n {data.paymentTerms.dueDate}\r\n </Text>\r\n </View>\r\n </Section>\r\n <Table variant=\"grid\" zebraStripe>\r\n <TableHeader>\r\n <TableRow header>\r\n <TableCell>Description</TableCell>\r\n <TableCell align=\"center\">QTY</TableCell>\r\n <TableCell align=\"center\">Rate</TableCell>\r\n <TableCell align=\"right\">Total</TableCell>\r\n </TableRow>\r\n </TableHeader>\r\n <TableBody>\r\n {data.items.map((item, index) => (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\r\n <TableRow key={index}>\r\n <TableCell>{item.description}</TableCell>\r\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\r\n <TableCell align=\"center\">{`$${item.unitPrice}`}</TableCell>\r\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\r\n </TableRow>\r\n ))}\r\n </TableBody>\r\n </Table>\r\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 16 }}>\r\n <View style={{ marginLeft: \"auto\", width: 220 }}>\r\n <KeyValue\r\n size=\"sm\"\r\n dividerThickness={1}\r\n items={[\r\n {\r\n key: \"Subtotal\",\r\n value: `$${data.summary.subtotal.toFixed(2)}`,\r\n },\r\n { key: \"Tax\", value: `$${data.summary.tax.toFixed(2)}` },\r\n {\r\n key: \"Total\",\r\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\r\n value: `$${data.summary.total.toFixed(2)}`,\r\n valueStyle: { fontSize: 12, fontWeight: \"bold\" },\r\n },\r\n ]}\r\n divided\r\n />\r\n </View>\r\n </Section>\r\n <PageFooter\r\n leftText={data.notes}\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={25}\r\n />\r\n </Page>\r\n </Document>\r\n );\r\n};\r\n\r\nexport const InvoiceClassicDocument = ({\r\n theme,\r\n data = sampleData,\r\n}: {\r\n theme?: PdfcnTheme;\r\n data?: InvoiceClassicData;\r\n}) => (\r\n <PdfcnThemeProvider theme={theme}>\r\n <InvoiceClassicContent data={data} />\r\n </PdfcnThemeProvider>\r\n);\r\n",
+ "content": "import { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { PdfImage } from \"@/components/pdf/pdf-image/pdf-image\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { InvoiceClassicData } from \"./invoice-classic.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: InvoiceClassicData = {\n billTo: {\n address: \"456 Client Ave, Suite 2\",\n email: \"[email protected]\",\n name: \"Client Corp.\",\n phone: \"+1 (555) 123-4567\",\n },\n companyAddress: \"Nagpur, IN\",\n companyEmail: \"[email protected]\",\n companyName: \"pdfcn\",\n dueDate: \"March 17, 2026\",\n invoiceDate: \"February 17, 2026\",\n invoiceNumber: \"INV-2026-001\",\n items: [\n { description: \"Web Development\", quantity: 1, unitPrice: 12_500 },\n { description: \"UI/UX Design\", quantity: 1, unitPrice: 8750 },\n { description: \"Consulting\", quantity: 10, unitPrice: 1500 },\n ],\n logo: \"/favicon.png\",\n notes: \"Thank you for your business!\",\n paymentTerms: {\n dueDate: \"March 17, 2026\",\n gst: \"GSTIN 123456789\",\n method: \"UPI / Card / Bank Transfer\",\n },\n subtitle: \"Innovative PDF Solutions\",\n summary: {\n subtotal: 36_250,\n tax: 2537.5,\n total: 38_787.5,\n },\n};\n\nconst InvoiceClassicContent = ({ data }: { data: InvoiceClassicData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"logo-left\"\n logo={\n <PdfImage src={data.logo ?? \"/favicon.png\"} style={{ margin: 0 }} />\n }\n title={data.companyName}\n subtitle={data.subtitle}\n rightText={data.invoiceNumber}\n rightSubText={`Due: ${data.dueDate}`}\n style={{ marginBottom: 0 }}\n />\n <Section noWrap style={{ flexDirection: \"row\" }}>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n From\n </Text>\n <Text noMargin variant=\"xs\">\n {data.companyName}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.companyAddress}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.companyEmail}\n </Text>\n </View>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Bill To\n </Text>\n <Text noMargin variant=\"xs\">\n {data.billTo.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.billTo.address}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.billTo.email}\n </Text>\n </View>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Payment Terms\n </Text>\n <Text noMargin variant=\"xs\">\n {data.paymentTerms.method}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.paymentTerms.gst}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.paymentTerms.dueDate}\n </Text>\n </View>\n </Section>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">QTY</TableCell>\n <TableCell align=\"center\">Rate</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"center\">{`$${item.unitPrice}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 16 }}>\n <View style={{ marginLeft: \"auto\", width: 220 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toFixed(2)}`,\n },\n { key: \"Tax\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Total\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: { fontSize: 12, fontWeight: \"bold\" },\n },\n ]}\n divided\n />\n </View>\n </Section>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceClassicDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceClassicData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceClassicContent data={data} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-classic/invoice-classic.tsx"
},
{
"path": "registry/bases/takumi/blocks/invoice-classic/invoice-classic.types.ts",
- "content": "export interface InvoiceClassicData {\r\n invoiceNumber: string;\r\n invoiceDate: string;\r\n dueDate: string;\r\n companyName: string;\r\n subtitle: string;\r\n companyAddress: string;\r\n companyEmail: string;\r\n logo?: string;\r\n billTo: {\r\n name: string;\r\n address: string;\r\n email: string;\r\n phone: string;\r\n };\r\n items: {\r\n description: string;\r\n quantity: number;\r\n unitPrice: number;\r\n }[];\r\n summary: {\r\n subtotal: number;\r\n tax: number;\r\n total: number;\r\n };\r\n paymentTerms: {\r\n dueDate: string;\r\n method: string;\r\n gst: string;\r\n };\r\n notes?: string;\r\n}\r\n",
+ "content": "export interface InvoiceClassicData {\n invoiceNumber: string;\n invoiceDate: string;\n dueDate: string;\n companyName: string;\n subtitle: string;\n companyAddress: string;\n companyEmail: string;\n logo?: string;\n billTo: {\n name: string;\n address: string;\n email: string;\n phone: string;\n };\n items: {\n description: string;\n quantity: number;\n unitPrice: number;\n }[];\n summary: {\n subtotal: number;\n tax: number;\n total: number;\n };\n paymentTerms: {\n dueDate: string;\n method: string;\n gst: string;\n };\n notes?: string;\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-classic/invoice-classic.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/invoice-consultant.json b/apps/web/public/r/takumi/invoice-consultant.json
index 9e98524..d27f77b 100644
--- a/apps/web/public/r/takumi/invoice-consultant.json
+++ b/apps/web/public/r/takumi/invoice-consultant.json
@@ -18,16 +18,16 @@
"files": [
{
"path": "registry/bases/takumi/blocks/invoice-consultant/invoice-consultant.tsx",
- "content": "import { KeyValue } from \"@/registry/bases/takumi/components/key-value/key-value\";\r\nimport { PageFooter } from \"@/registry/bases/takumi/components/page-footer/page-footer\";\r\nimport { Section } from \"@/registry/bases/takumi/components/section/section\";\r\nimport {\r\n Table,\r\n TableBody,\r\n TableCell,\r\n TableHeader,\r\n TableRow,\r\n} from \"@/registry/bases/takumi/components/table/table\";\r\nimport { Text } from \"@/registry/bases/takumi/components/text/text\";\r\nimport {\r\n PdfcnThemeProvider,\r\n usePdfcnTheme,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n StyleSheet,\r\n Document,\r\n Page,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { InvoiceConsultantData } from \"./invoice-consultant.types\";\r\n\r\nconst sampleData: InvoiceConsultantData = {\r\n client: {\r\n address: \"500 Tech Park, Suite 200\",\r\n company: \"Acme Technologies\",\r\n email: \"[email protected]\",\r\n name: \"Sarah Johnson\",\r\n },\r\n companyAddress: \"Nagpur, IN · [email protected]\",\r\n companyName: \"pdfcn\",\r\n consultant: {\r\n email: \"[email protected]\",\r\n name: \"John Smith\",\r\n title: \"Senior Technical Consultant\",\r\n },\r\n dueDate: \"March 28, 2026\",\r\n invoiceDate: \"February 26, 2026\",\r\n invoiceNumber: \"INV-2026-006\",\r\n notes:\r\n \"Services rendered for February 2026. All hours verified and approved by client.\",\r\n paymentTerms: {\r\n dueDate: \"March 28, 2026\",\r\n method: \"Bank Transfer / Check\",\r\n },\r\n projectRef: \"PROJ-2026-ACME-001\",\r\n services: [\r\n { description: \"Architecture Review & Planning\", hours: 16, rate: 175 },\r\n { description: \"Code Review & Optimization\", hours: 24, rate: 150 },\r\n { description: \"Technical Documentation\", hours: 12, rate: 125 },\r\n { description: \"Team Training & Knowledge Transfer\", hours: 8, rate: 200 },\r\n ],\r\n subtitle: \"Professional Consulting Services\",\r\n summary: {\r\n subtotal: 9500,\r\n tax: 475,\r\n total: 9975,\r\n totalHours: 60,\r\n },\r\n};\r\n\r\nconst InvoiceConsultantContent = ({\r\n data,\r\n}: {\r\n data: InvoiceConsultantData;\r\n}) => {\r\n const theme = usePdfcnTheme();\r\n\r\n const styles = StyleSheet.create({\r\n calloutNote: {\r\n backgroundColor: theme.colors.muted,\r\n borderLeftColor: theme.colors.info,\r\n borderLeftStyle: \"solid\",\r\n borderLeftWidth: 3,\r\n marginTop: 16,\r\n paddingLeft: 12,\r\n paddingVertical: 8,\r\n },\r\n companyInfo: {\r\n flex: 1,\r\n },\r\n headerRow: {\r\n alignItems: \"flex-start\",\r\n borderBottomColor: theme.colors.primary,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: 2,\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n marginBottom: theme.spacing.sectionGap,\r\n paddingBottom: theme.spacing.componentGap,\r\n },\r\n hoursBadge: {\r\n alignSelf: \"flex-start\",\r\n backgroundColor: theme.colors.primary,\r\n borderRadius: theme.primitives.borderRadius.sm,\r\n color: theme.colors.primaryForeground,\r\n paddingHorizontal: 12,\r\n paddingVertical: 8,\r\n },\r\n hoursBox: {\r\n flex: 1,\r\n paddingRight: 24,\r\n },\r\n invoiceInfo: {\r\n alignItems: \"flex-end\",\r\n },\r\n page: {\r\n backgroundColor: theme.colors.background,\r\n boxSizing: \"border-box\",\r\n minHeight: 841,\r\n padding: theme.spacing.page.marginTop,\r\n paddingBottom: theme.spacing.page.marginBottom,\r\n position: \"relative\",\r\n },\r\n partiesRow: {\r\n flexDirection: \"row\",\r\n gap: 40,\r\n marginBottom: theme.spacing.sectionGap,\r\n },\r\n partyColumn: {\r\n flex: 1,\r\n },\r\n partyLabel: {\r\n borderBottomColor: theme.colors.border,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: 1,\r\n color: theme.colors.primary,\r\n fontSize: 9,\r\n fontWeight: \"bold\",\r\n letterSpacing: 0.6,\r\n marginBottom: 6,\r\n paddingBottom: 4,\r\n textTransform: \"uppercase\",\r\n },\r\n projectRef: {\r\n alignItems: \"center\",\r\n backgroundColor: theme.colors.muted,\r\n borderRadius: theme.primitives.borderRadius.sm,\r\n flexDirection: \"row\",\r\n gap: 8,\r\n marginBottom: theme.spacing.sectionGap,\r\n paddingHorizontal: 10,\r\n paddingVertical: 6,\r\n },\r\n summaryRow: {\r\n flexDirection: \"row\",\r\n marginTop: 20,\r\n },\r\n totalsBox: {\r\n width: 250,\r\n },\r\n });\r\n\r\n return (\r\n <Document title={`Invoice ${data.invoiceNumber}`}>\r\n <Page size=\"A4\" style={styles.page}>\r\n <View style={styles.headerRow}>\r\n <View style={styles.companyInfo}>\r\n <Text variant=\"xl\" weight=\"bold\" noMargin>\r\n {data.companyName}\r\n </Text>\r\n <Text variant=\"sm\" color=\"mutedForeground\" noMargin>\r\n {data.subtitle}\r\n </Text>\r\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\r\n {data.companyAddress}\r\n </Text>\r\n </View>\r\n <View style={styles.invoiceInfo}>\r\n <Text\r\n variant=\"xs\"\r\n color=\"mutedForeground\"\r\n transform=\"uppercase\"\r\n noMargin\r\n >\r\n Invoice\r\n </Text>\r\n <Text variant=\"lg\" weight=\"bold\" noMargin>\r\n {data.invoiceNumber}\r\n </Text>\r\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\r\n {data.invoiceDate}\r\n </Text>\r\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\r\n Due: {data.dueDate}\r\n </Text>\r\n </View>\r\n </View>\r\n {data.projectRef && (\r\n <View style={styles.projectRef}>\r\n <Text\r\n variant=\"xs\"\r\n weight=\"semibold\"\r\n color=\"mutedForeground\"\r\n noMargin\r\n >\r\n Project Reference:\r\n </Text>\r\n <Text variant=\"xs\" weight=\"bold\" noMargin>\r\n {data.projectRef}\r\n </Text>\r\n </View>\r\n )}\r\n <View style={styles.partiesRow}>\r\n <View style={styles.partyColumn}>\r\n <Text style={styles.partyLabel} noMargin>\r\n From (Consultant)\r\n </Text>\r\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\r\n {data.consultant.name}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.consultant.title}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.consultant.email}\r\n </Text>\r\n </View>\r\n <View style={styles.partyColumn}>\r\n <Text style={styles.partyLabel} noMargin>\r\n Bill To (Client)\r\n </Text>\r\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\r\n {data.client.name}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.client.company}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.client.address}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.client.email}\r\n </Text>\r\n </View>\r\n </View>\r\n <Table variant=\"line\">\r\n <TableHeader>\r\n <TableRow header>\r\n <TableCell>Service Description</TableCell>\r\n <TableCell align=\"center\">Hours</TableCell>\r\n <TableCell align=\"right\">Rate ($/hr)</TableCell>\r\n <TableCell align=\"right\">Amount</TableCell>\r\n </TableRow>\r\n </TableHeader>\r\n <TableBody>\r\n {data.services.map((service, index) => (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\r\n <TableRow key={index}>\r\n <TableCell>{service.description}</TableCell>\r\n <TableCell align=\"center\">{`${service.hours}`}</TableCell>\r\n <TableCell align=\"right\">{`$${service.rate}`}</TableCell>\r\n <TableCell align=\"right\">{`$${(service.hours * service.rate).toLocaleString()}`}</TableCell>\r\n </TableRow>\r\n ))}\r\n </TableBody>\r\n </Table>\r\n <Section noWrap style={styles.summaryRow}>\r\n <View style={styles.hoursBox}>\r\n <View style={styles.hoursBadge}>\r\n <Text\r\n style={{\r\n color: theme.colors.primaryForeground,\r\n fontSize: 9,\r\n fontWeight: \"bold\",\r\n }}\r\n noMargin\r\n >\r\n Total Hours: {data.summary.totalHours}\r\n </Text>\r\n </View>\r\n <Text variant=\"xs\" color=\"mutedForeground\" style={{ marginTop: 8 }}>\r\n Payment: {data.paymentTerms.method}\r\n </Text>\r\n </View>\r\n <View style={styles.totalsBox}>\r\n <KeyValue\r\n size=\"sm\"\r\n dividerThickness={1}\r\n items={[\r\n {\r\n key: \"Subtotal\",\r\n value: `$${data.summary.subtotal.toLocaleString()}`,\r\n },\r\n { key: \"Tax (5%)\", value: `$${data.summary.tax.toFixed(2)}` },\r\n {\r\n key: \"Amount Due\",\r\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\r\n value: `$${data.summary.total.toFixed(2)}`,\r\n valueStyle: {\r\n color: theme.colors.primary,\r\n fontSize: 14,\r\n fontWeight: \"bold\",\r\n },\r\n },\r\n ]}\r\n divided\r\n />\r\n </View>\r\n </Section>\r\n {data.notes && (\r\n <View style={styles.calloutNote}>\r\n <Text variant=\"xs\" color=\"mutedForeground\">\r\n {data.notes}\r\n </Text>\r\n </View>\r\n )}\r\n <PageFooter\r\n leftText=\"Professional services invoice – Please retain for records\"\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={25}\r\n />\r\n </Page>\r\n </Document>\r\n );\r\n};\r\n\r\nexport const InvoiceConsultantDocument = ({\r\n theme,\r\n data = sampleData,\r\n}: {\r\n theme?: PdfcnTheme;\r\n data?: InvoiceConsultantData;\r\n}) => (\r\n <PdfcnThemeProvider theme={theme}>\r\n <InvoiceConsultantContent data={data} />\r\n </PdfcnThemeProvider>\r\n);\r\n",
+ "content": "import { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { InvoiceConsultantData } from \"./invoice-consultant.types\";\n\nconst sampleData: InvoiceConsultantData = {\n client: {\n address: \"500 Tech Park, Suite 200\",\n company: \"Acme Technologies\",\n email: \"[email protected]\",\n name: \"Sarah Johnson\",\n },\n companyAddress: \"Nagpur, IN · [email protected]\",\n companyName: \"pdfcn\",\n consultant: {\n email: \"[email protected]\",\n name: \"John Smith\",\n title: \"Senior Technical Consultant\",\n },\n dueDate: \"March 28, 2026\",\n invoiceDate: \"February 26, 2026\",\n invoiceNumber: \"INV-2026-006\",\n notes:\n \"Services rendered for February 2026. All hours verified and approved by client.\",\n paymentTerms: {\n dueDate: \"March 28, 2026\",\n method: \"Bank Transfer / Check\",\n },\n projectRef: \"PROJ-2026-ACME-001\",\n services: [\n { description: \"Architecture Review & Planning\", hours: 16, rate: 175 },\n { description: \"Code Review & Optimization\", hours: 24, rate: 150 },\n { description: \"Technical Documentation\", hours: 12, rate: 125 },\n { description: \"Team Training & Knowledge Transfer\", hours: 8, rate: 200 },\n ],\n subtitle: \"Professional Consulting Services\",\n summary: {\n subtotal: 9500,\n tax: 475,\n total: 9975,\n totalHours: 60,\n },\n};\n\nconst InvoiceConsultantContent = ({\n data,\n}: {\n data: InvoiceConsultantData;\n}) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n calloutNote: {\n backgroundColor: theme.colors.muted,\n borderLeftColor: theme.colors.info,\n borderLeftStyle: \"solid\",\n borderLeftWidth: 3,\n marginTop: 16,\n paddingLeft: 12,\n paddingVertical: 8,\n },\n companyInfo: {\n flex: 1,\n },\n headerRow: {\n alignItems: \"flex-start\",\n borderBottomColor: theme.colors.primary,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 2,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: theme.spacing.sectionGap,\n paddingBottom: theme.spacing.componentGap,\n },\n hoursBadge: {\n alignSelf: \"flex-start\",\n backgroundColor: theme.colors.primary,\n borderRadius: theme.primitives.borderRadius.sm,\n color: theme.colors.primaryForeground,\n paddingHorizontal: 12,\n paddingVertical: 8,\n },\n hoursBox: {\n flex: 1,\n paddingRight: 24,\n },\n invoiceInfo: {\n alignItems: \"flex-end\",\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n partiesRow: {\n flexDirection: \"row\",\n gap: 40,\n marginBottom: theme.spacing.sectionGap,\n },\n partyColumn: {\n flex: 1,\n },\n partyLabel: {\n borderBottomColor: theme.colors.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n color: theme.colors.primary,\n fontSize: 9,\n fontWeight: \"bold\",\n letterSpacing: 0.6,\n marginBottom: 6,\n paddingBottom: 4,\n textTransform: \"uppercase\",\n },\n projectRef: {\n alignItems: \"center\",\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.sm,\n flexDirection: \"row\",\n gap: 8,\n marginBottom: theme.spacing.sectionGap,\n paddingHorizontal: 10,\n paddingVertical: 6,\n },\n summaryRow: {\n flexDirection: \"row\",\n marginTop: 20,\n },\n totalsBox: {\n width: 250,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <View style={styles.headerRow}>\n <View style={styles.companyInfo}>\n <Text variant=\"xl\" weight=\"bold\" noMargin>\n {data.companyName}\n </Text>\n <Text variant=\"sm\" color=\"mutedForeground\" noMargin>\n {data.subtitle}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {data.companyAddress}\n </Text>\n </View>\n <View style={styles.invoiceInfo}>\n <Text\n variant=\"xs\"\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Invoice\n </Text>\n <Text variant=\"lg\" weight=\"bold\" noMargin>\n {data.invoiceNumber}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {data.invoiceDate}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Due: {data.dueDate}\n </Text>\n </View>\n </View>\n {data.projectRef && (\n <View style={styles.projectRef}>\n <Text\n variant=\"xs\"\n weight=\"semibold\"\n color=\"mutedForeground\"\n noMargin\n >\n Project Reference:\n </Text>\n <Text variant=\"xs\" weight=\"bold\" noMargin>\n {data.projectRef}\n </Text>\n </View>\n )}\n <View style={styles.partiesRow}>\n <View style={styles.partyColumn}>\n <Text style={styles.partyLabel} noMargin>\n From (Consultant)\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.consultant.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.consultant.title}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.consultant.email}\n </Text>\n </View>\n <View style={styles.partyColumn}>\n <Text style={styles.partyLabel} noMargin>\n Bill To (Client)\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.client.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.client.company}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.client.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.client.email}\n </Text>\n </View>\n </View>\n <Table variant=\"line\">\n <TableHeader>\n <TableRow header>\n <TableCell>Service Description</TableCell>\n <TableCell align=\"center\">Hours</TableCell>\n <TableCell align=\"right\">Rate ($/hr)</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.services.map((service, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\n <TableRow key={index}>\n <TableCell>{service.description}</TableCell>\n <TableCell align=\"center\">{`${service.hours}`}</TableCell>\n <TableCell align=\"right\">{`$${service.rate}`}</TableCell>\n <TableCell align=\"right\">{`$${(service.hours * service.rate).toLocaleString()}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={styles.summaryRow}>\n <View style={styles.hoursBox}>\n <View style={styles.hoursBadge}>\n <Text\n style={{\n color: theme.colors.primaryForeground,\n fontSize: 9,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n Total Hours: {data.summary.totalHours}\n </Text>\n </View>\n <Text variant=\"xs\" color=\"mutedForeground\" style={{ marginTop: 8 }}>\n Payment: {data.paymentTerms.method}\n </Text>\n </View>\n <View style={styles.totalsBox}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toLocaleString()}`,\n },\n { key: \"Tax (5%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Amount Due\",\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.primary,\n fontSize: 14,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </Section>\n {data.notes && (\n <View style={styles.calloutNote}>\n <Text variant=\"xs\" color=\"mutedForeground\">\n {data.notes}\n </Text>\n </View>\n )}\n <PageFooter\n leftText=\"Professional services invoice – Please retain for records\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceConsultantDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceConsultantData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceConsultantContent data={data} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-consultant/invoice-consultant.tsx"
},
{
"path": "registry/bases/takumi/blocks/invoice-consultant/invoice-consultant.types.ts",
- "content": "export interface InvoiceConsultantData {\r\n invoiceNumber: string;\r\n invoiceDate: string;\r\n dueDate: string;\r\n companyName: string;\r\n subtitle: string;\r\n companyAddress: string;\r\n consultant: {\r\n name: string;\r\n title: string;\r\n email: string;\r\n };\r\n client: {\r\n name: string;\r\n company: string;\r\n address: string;\r\n email: string;\r\n };\r\n services: {\r\n description: string;\r\n hours: number;\r\n rate: number;\r\n }[];\r\n summary: {\r\n totalHours: number;\r\n subtotal: number;\r\n tax: number;\r\n total: number;\r\n };\r\n paymentTerms: {\r\n dueDate: string;\r\n method: string;\r\n };\r\n projectRef?: string;\r\n notes?: string;\r\n}\r\n",
+ "content": "export interface InvoiceConsultantData {\n invoiceNumber: string;\n invoiceDate: string;\n dueDate: string;\n companyName: string;\n subtitle: string;\n companyAddress: string;\n consultant: {\n name: string;\n title: string;\n email: string;\n };\n client: {\n name: string;\n company: string;\n address: string;\n email: string;\n };\n services: {\n description: string;\n hours: number;\n rate: number;\n }[];\n summary: {\n totalHours: number;\n subtotal: number;\n tax: number;\n total: number;\n };\n paymentTerms: {\n dueDate: string;\n method: string;\n };\n projectRef?: string;\n notes?: string;\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-consultant/invoice-consultant.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/invoice-corporate.json b/apps/web/public/r/takumi/invoice-corporate.json
index e23e18a..b68c04e 100644
--- a/apps/web/public/r/takumi/invoice-corporate.json
+++ b/apps/web/public/r/takumi/invoice-corporate.json
@@ -19,16 +19,16 @@
"files": [
{
"path": "registry/bases/takumi/blocks/invoice-corporate/invoice-corporate.tsx",
- "content": "import { KeyValue } from \"@/registry/bases/takumi/components/key-value/key-value\";\r\nimport { PageFooter } from \"@/registry/bases/takumi/components/page-footer/page-footer\";\r\nimport { PageHeader } from \"@/registry/bases/takumi/components/page-header/page-header\";\r\nimport { PdfImage } from \"@/registry/bases/takumi/components/pdf-image/pdf-image\";\r\nimport {\r\n Table,\r\n TableBody,\r\n TableCell,\r\n TableHeader,\r\n TableRow,\r\n} from \"@/registry/bases/takumi/components/table/table\";\r\nimport { Text } from \"@/registry/bases/takumi/components/text/text\";\r\nimport {\r\n PdfcnThemeProvider,\r\n usePdfcnTheme,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n StyleSheet,\r\n Document,\r\n Page,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { InvoiceCorporateData } from \"./invoice-corporate.types\";\r\n\r\nconst sampleData: InvoiceCorporateData = {\r\n billTo: {\r\n address: \"100 Corporate Plaza, Tower B\",\r\n email: \"[email protected]\",\r\n name: \"Global Industries Ltd.\",\r\n phone: \"+1 (555) 888-9999\",\r\n },\r\n companyAddress: \"Nagpur, IN\",\r\n companyEmail: \"[email protected]\",\r\n companyName: \"pdfcn\",\r\n dueDate: \"March 24, 2026\",\r\n invoiceDate: \"February 22, 2026\",\r\n invoiceNumber: \"INV-2026-004\",\r\n items: [\r\n {\r\n description: \"Enterprise Software License\",\r\n quantity: 5,\r\n unitPrice: 4500,\r\n },\r\n { description: \"Implementation Services\", quantity: 1, unitPrice: 18_000 },\r\n {\r\n description: \"Training Workshop (per session)\",\r\n quantity: 3,\r\n unitPrice: 2500,\r\n },\r\n { description: \"Annual Support Package\", quantity: 1, unitPrice: 8500 },\r\n ],\r\n logo: \"/favicon.png\",\r\n notes:\r\n \"Corporate billing – Net 30 terms apply. For inquiries, contact [email protected]\",\r\n paymentTerms: {\r\n dueDate: \"March 24, 2026\",\r\n gst: \"GSTIN 987654321\",\r\n method: \"Wire Transfer / Corporate Account\",\r\n },\r\n subtitle: \"Innovative PDF Solutions\",\r\n summary: {\r\n subtotal: 56_500,\r\n tax: 4520,\r\n total: 61_020,\r\n },\r\n};\r\n\r\nconst InvoiceCorporateContent = ({ data }: { data: InvoiceCorporateData }) => {\r\n const theme = usePdfcnTheme();\r\n\r\n const styles = StyleSheet.create({\r\n infoColumn: {\r\n flex: 1,\r\n },\r\n infoGrid: {\r\n flexDirection: \"row\",\r\n gap: 24,\r\n marginBottom: theme.spacing.sectionGap,\r\n },\r\n infoLabel: {\r\n color: theme.colors.mutedForeground,\r\n fontSize: 9,\r\n fontWeight: \"bold\",\r\n letterSpacing: 0.6,\r\n marginBottom: 6,\r\n textTransform: \"uppercase\",\r\n },\r\n page: {\r\n backgroundColor: theme.colors.background,\r\n boxSizing: \"border-box\",\r\n minHeight: 841,\r\n padding: theme.spacing.page.marginTop,\r\n paddingBottom: theme.spacing.page.marginBottom,\r\n position: \"relative\",\r\n },\r\n summaryCard: {\r\n backgroundColor: theme.colors.muted,\r\n borderRadius: theme.primitives.borderRadius.md,\r\n marginTop: 20,\r\n padding: 16,\r\n },\r\n summaryRow: {\r\n flexDirection: \"row\",\r\n justifyContent: \"flex-end\",\r\n },\r\n });\r\n\r\n return (\r\n <Document title={`Invoice ${data.invoiceNumber}`}>\r\n <Page size=\"A4\" style={styles.page}>\r\n <PageHeader\r\n variant=\"logo-right\"\r\n logo={\r\n <PdfImage\r\n src={data.logo ?? \"/favicon.png\"}\r\n width={56}\r\n height={56}\r\n style={{ margin: 0 }}\r\n />\r\n }\r\n title={data.companyName}\r\n subtitle={`${data.subtitle} · ${data.companyAddress}`}\r\n style={{ marginBottom: theme.spacing.sectionGap }}\r\n />\r\n <View style={styles.infoGrid}>\r\n <View style={styles.infoColumn}>\r\n <Text style={styles.infoLabel} noMargin>\r\n Invoice Details\r\n </Text>\r\n <KeyValue\r\n size=\"sm\"\r\n items={[\r\n { key: \"Invoice #\", value: data.invoiceNumber },\r\n { key: \"Issue Date\", value: data.invoiceDate },\r\n { key: \"Due Date\", value: data.dueDate },\r\n { key: \"Payment\", value: data.paymentTerms.method },\r\n ]}\r\n />\r\n </View>\r\n <View style={styles.infoColumn}>\r\n <Text style={styles.infoLabel} noMargin>\r\n Bill To\r\n </Text>\r\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\r\n {data.billTo.name}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.billTo.address}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.billTo.email}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.billTo.phone}\r\n </Text>\r\n </View>\r\n </View>\r\n <Table variant=\"bordered\">\r\n <TableHeader>\r\n <TableRow header>\r\n <TableCell>Description</TableCell>\r\n <TableCell align=\"center\">Qty</TableCell>\r\n <TableCell align=\"right\">Unit Price</TableCell>\r\n <TableCell align=\"right\">Amount</TableCell>\r\n </TableRow>\r\n </TableHeader>\r\n <TableBody>\r\n {data.items.map((item, index) => (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\r\n <TableRow key={index}>\r\n <TableCell>{item.description}</TableCell>\r\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\r\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\r\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toLocaleString()}`}</TableCell>\r\n </TableRow>\r\n ))}\r\n </TableBody>\r\n </Table>\r\n <View style={styles.summaryCard}>\r\n <View style={styles.summaryRow}>\r\n <View style={{ width: 260 }}>\r\n <KeyValue\r\n size=\"md\"\r\n dividerThickness={1}\r\n dividerColor=\"border\"\r\n items={[\r\n {\r\n key: \"Subtotal\",\r\n value: `$${data.summary.subtotal.toLocaleString()}`,\r\n },\r\n { key: \"Tax (8%)\", value: `$${data.summary.tax.toFixed(2)}` },\r\n {\r\n key: \"Total Due\",\r\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\r\n value: `$${data.summary.total.toFixed(2)}`,\r\n valueStyle: {\r\n color: theme.colors.primary,\r\n fontSize: 14,\r\n fontWeight: \"bold\",\r\n },\r\n },\r\n ]}\r\n divided\r\n />\r\n </View>\r\n </View>\r\n </View>\r\n <PageFooter\r\n leftText={data.notes}\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={25}\r\n />\r\n </Page>\r\n </Document>\r\n );\r\n};\r\n\r\nexport const InvoiceCorporateDocument = ({\r\n theme,\r\n data = sampleData,\r\n}: {\r\n theme?: PdfcnTheme;\r\n data?: InvoiceCorporateData;\r\n}) => (\r\n <PdfcnThemeProvider theme={theme}>\r\n <InvoiceCorporateContent data={data} />\r\n </PdfcnThemeProvider>\r\n);\r\n",
+ "content": "import { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { PdfImage } from \"@/components/pdf/pdf-image/pdf-image\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { InvoiceCorporateData } from \"./invoice-corporate.types\";\n\nconst sampleData: InvoiceCorporateData = {\n billTo: {\n address: \"100 Corporate Plaza, Tower B\",\n email: \"[email protected]\",\n name: \"Global Industries Ltd.\",\n phone: \"+1 (555) 888-9999\",\n },\n companyAddress: \"Nagpur, IN\",\n companyEmail: \"[email protected]\",\n companyName: \"pdfcn\",\n dueDate: \"March 24, 2026\",\n invoiceDate: \"February 22, 2026\",\n invoiceNumber: \"INV-2026-004\",\n items: [\n {\n description: \"Enterprise Software License\",\n quantity: 5,\n unitPrice: 4500,\n },\n { description: \"Implementation Services\", quantity: 1, unitPrice: 18_000 },\n {\n description: \"Training Workshop (per session)\",\n quantity: 3,\n unitPrice: 2500,\n },\n { description: \"Annual Support Package\", quantity: 1, unitPrice: 8500 },\n ],\n logo: \"/favicon.png\",\n notes:\n \"Corporate billing – Net 30 terms apply. For inquiries, contact [email protected]\",\n paymentTerms: {\n dueDate: \"March 24, 2026\",\n gst: \"GSTIN 987654321\",\n method: \"Wire Transfer / Corporate Account\",\n },\n subtitle: \"Innovative PDF Solutions\",\n summary: {\n subtotal: 56_500,\n tax: 4520,\n total: 61_020,\n },\n};\n\nconst InvoiceCorporateContent = ({ data }: { data: InvoiceCorporateData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n infoColumn: {\n flex: 1,\n },\n infoGrid: {\n flexDirection: \"row\",\n gap: 24,\n marginBottom: theme.spacing.sectionGap,\n },\n infoLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n fontWeight: \"bold\",\n letterSpacing: 0.6,\n marginBottom: 6,\n textTransform: \"uppercase\",\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n summaryCard: {\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.md,\n marginTop: 20,\n padding: 16,\n },\n summaryRow: {\n flexDirection: \"row\",\n justifyContent: \"flex-end\",\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"logo-right\"\n logo={\n <PdfImage\n src={data.logo ?? \"/favicon.png\"}\n width={56}\n height={56}\n style={{ margin: 0 }}\n />\n }\n title={data.companyName}\n subtitle={`${data.subtitle} · ${data.companyAddress}`}\n style={{ marginBottom: theme.spacing.sectionGap }}\n />\n <View style={styles.infoGrid}>\n <View style={styles.infoColumn}>\n <Text style={styles.infoLabel} noMargin>\n Invoice Details\n </Text>\n <KeyValue\n size=\"sm\"\n items={[\n { key: \"Invoice #\", value: data.invoiceNumber },\n { key: \"Issue Date\", value: data.invoiceDate },\n { key: \"Due Date\", value: data.dueDate },\n { key: \"Payment\", value: data.paymentTerms.method },\n ]}\n />\n </View>\n <View style={styles.infoColumn}>\n <Text style={styles.infoLabel} noMargin>\n Bill To\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.billTo.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.email}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.phone}\n </Text>\n </View>\n </View>\n <Table variant=\"bordered\">\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Unit Price</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toLocaleString()}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <View style={styles.summaryCard}>\n <View style={styles.summaryRow}>\n <View style={{ width: 260 }}>\n <KeyValue\n size=\"md\"\n dividerThickness={1}\n dividerColor=\"border\"\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toLocaleString()}`,\n },\n { key: \"Tax (8%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Total Due\",\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.primary,\n fontSize: 14,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </View>\n </View>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceCorporateDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceCorporateData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceCorporateContent data={data} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-corporate/invoice-corporate.tsx"
},
{
"path": "registry/bases/takumi/blocks/invoice-corporate/invoice-corporate.types.ts",
- "content": "export interface InvoiceCorporateData {\r\n invoiceNumber: string;\r\n invoiceDate: string;\r\n dueDate: string;\r\n companyName: string;\r\n subtitle: string;\r\n companyAddress: string;\r\n companyEmail: string;\r\n logo?: string;\r\n billTo: {\r\n name: string;\r\n address: string;\r\n email: string;\r\n phone: string;\r\n };\r\n items: {\r\n description: string;\r\n quantity: number;\r\n unitPrice: number;\r\n }[];\r\n summary: {\r\n subtotal: number;\r\n tax: number;\r\n total: number;\r\n };\r\n paymentTerms: {\r\n dueDate: string;\r\n method: string;\r\n gst: string;\r\n };\r\n notes?: string;\r\n}\r\n",
+ "content": "export interface InvoiceCorporateData {\n invoiceNumber: string;\n invoiceDate: string;\n dueDate: string;\n companyName: string;\n subtitle: string;\n companyAddress: string;\n companyEmail: string;\n logo?: string;\n billTo: {\n name: string;\n address: string;\n email: string;\n phone: string;\n };\n items: {\n description: string;\n quantity: number;\n unitPrice: number;\n }[];\n summary: {\n subtotal: number;\n tax: number;\n total: number;\n };\n paymentTerms: {\n dueDate: string;\n method: string;\n gst: string;\n };\n notes?: string;\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-corporate/invoice-corporate.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/invoice-creative.json b/apps/web/public/r/takumi/invoice-creative.json
index f3d09bc..aebab6e 100644
--- a/apps/web/public/r/takumi/invoice-creative.json
+++ b/apps/web/public/r/takumi/invoice-creative.json
@@ -19,16 +19,16 @@
"files": [
{
"path": "registry/bases/takumi/blocks/invoice-creative/invoice-creative.tsx",
- "content": "import { KeyValue } from \"@/registry/bases/takumi/components/key-value/key-value\";\r\nimport { PageFooter } from \"@/registry/bases/takumi/components/page-footer/page-footer\";\r\nimport { PageHeader } from \"@/registry/bases/takumi/components/page-header/page-header\";\r\nimport { Section } from \"@/registry/bases/takumi/components/section/section\";\r\nimport {\r\n Table,\r\n TableBody,\r\n TableCell,\r\n TableHeader,\r\n TableRow,\r\n} from \"@/registry/bases/takumi/components/table/table\";\r\nimport { Text } from \"@/registry/bases/takumi/components/text/text\";\r\nimport {\r\n PdfcnThemeProvider,\r\n usePdfcnTheme,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n StyleSheet,\r\n Document,\r\n Page,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { InvoiceCreativeData } from \"./invoice-creative.types\";\r\n\r\nconst sampleData: InvoiceCreativeData = {\r\n billTo: {\r\n address: \"250 Design District, Loft 5\",\r\n email: \"[email protected]\",\r\n name: \"Creative Agency Co.\",\r\n phone: \"+1 (555) 321-7654\",\r\n },\r\n companyAddress: \"Nagpur, IN · [email protected]\",\r\n companyName: \"pdfcn\",\r\n dueDate: \"March 26, 2026\",\r\n invoiceDate: \"February 24, 2026\",\r\n invoiceNumber: \"INV-2026-005\",\r\n items: [\r\n { description: \"Brand Identity Design\", quantity: 1, unitPrice: 8500 },\r\n {\r\n description: \"Marketing Collateral Package\",\r\n quantity: 1,\r\n unitPrice: 4200,\r\n },\r\n {\r\n description: \"Social Media Assets (per set)\",\r\n quantity: 4,\r\n unitPrice: 750,\r\n },\r\n { description: \"Motion Graphics (30s)\", quantity: 2, unitPrice: 3500 },\r\n ],\r\n notes:\r\n \"Creative work is protected under copyright. Full usage rights transfer upon payment.\",\r\n paymentTerms: {\r\n dueDate: \"March 26, 2026\",\r\n gst: \"GSTIN 456789123\",\r\n method: \"Credit Card / PayPal / Stripe\",\r\n },\r\n subtitle: \"Innovative PDF Solutions\",\r\n summary: {\r\n subtotal: 22_700,\r\n tax: 1475.5,\r\n total: 24_175.5,\r\n },\r\n};\r\n\r\nconst InvoiceCreativeContent = ({ data }: { data: InvoiceCreativeData }) => {\r\n const theme = usePdfcnTheme();\r\n\r\n const styles = StyleSheet.create({\r\n accentBlock: {\r\n backgroundColor: theme.colors.muted,\r\n borderLeftColor: theme.colors.accent,\r\n borderLeftStyle: \"solid\",\r\n borderLeftWidth: 4,\r\n marginBottom: theme.spacing.sectionGap,\r\n paddingLeft: 14,\r\n paddingVertical: 10,\r\n },\r\n badgeLabel: {\r\n color: theme.colors.primaryForeground,\r\n fontSize: 8,\r\n fontWeight: \"bold\",\r\n letterSpacing: 1.2,\r\n marginBottom: 2,\r\n textTransform: \"uppercase\",\r\n },\r\n badgeNumber: {\r\n color: theme.colors.primaryForeground,\r\n fontSize: 16,\r\n fontWeight: \"bold\",\r\n },\r\n heroSection: {\r\n alignItems: \"center\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n marginBottom: theme.spacing.sectionGap,\r\n },\r\n infoColumn: {\r\n flex: 1,\r\n },\r\n infoGrid: {\r\n flexDirection: \"row\",\r\n gap: 32,\r\n },\r\n invoiceBadge: {\r\n alignItems: \"center\",\r\n backgroundColor: theme.colors.primary,\r\n borderRadius: theme.primitives.borderRadius.md,\r\n paddingHorizontal: 20,\r\n paddingVertical: 14,\r\n },\r\n page: {\r\n backgroundColor: theme.colors.background,\r\n boxSizing: \"border-box\",\r\n minHeight: 841,\r\n padding: theme.spacing.page.marginTop,\r\n paddingBottom: theme.spacing.page.marginBottom,\r\n position: \"relative\",\r\n },\r\n sectionLabel: {\r\n color: theme.colors.accent,\r\n fontSize: 8,\r\n fontWeight: \"bold\",\r\n letterSpacing: 0.8,\r\n marginBottom: 6,\r\n textTransform: \"uppercase\",\r\n },\r\n summaryLeft: {\r\n flex: 1,\r\n paddingRight: 20,\r\n },\r\n summaryRight: {\r\n backgroundColor: theme.colors.muted,\r\n borderRadius: theme.primitives.borderRadius.sm,\r\n padding: 14,\r\n width: 240,\r\n },\r\n summarySection: {\r\n flexDirection: \"row\",\r\n marginTop: 24,\r\n },\r\n });\r\n\r\n return (\r\n <Document title={`Invoice ${data.invoiceNumber}`}>\r\n <Page size=\"A4\" style={styles.page}>\r\n <View style={styles.heroSection}>\r\n <View style={{ flex: 1 }}>\r\n <PageHeader\r\n variant=\"centered\"\r\n title={data.companyName}\r\n subtitle={`${data.subtitle} · ${data.companyAddress}`}\r\n marginBottom={0}\r\n />\r\n </View>\r\n <View style={styles.invoiceBadge}>\r\n <Text style={styles.badgeLabel} noMargin>\r\n Invoice\r\n </Text>\r\n <Text style={styles.badgeNumber} noMargin>\r\n {data.invoiceNumber}\r\n </Text>\r\n </View>\r\n </View>\r\n <View style={styles.accentBlock}>\r\n <View style={styles.infoGrid}>\r\n <View style={styles.infoColumn}>\r\n <Text style={styles.sectionLabel} noMargin>\r\n Billed To\r\n </Text>\r\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\r\n {data.billTo.name}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.billTo.address}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.billTo.email} · {data.billTo.phone}\r\n </Text>\r\n </View>\r\n <View style={styles.infoColumn}>\r\n <Text style={styles.sectionLabel} noMargin>\r\n Invoice Info\r\n </Text>\r\n <KeyValue\r\n size=\"sm\"\r\n items={[\r\n { key: \"Issue Date\", value: data.invoiceDate },\r\n { key: \"Due Date\", value: data.dueDate },\r\n { key: \"Payment\", value: data.paymentTerms.method },\r\n ]}\r\n />\r\n </View>\r\n </View>\r\n </View>\r\n <Table variant=\"striped\" zebraStripe>\r\n <TableHeader>\r\n <TableRow header>\r\n <TableCell>Deliverable</TableCell>\r\n <TableCell align=\"center\">Qty</TableCell>\r\n <TableCell align=\"right\">Rate</TableCell>\r\n <TableCell align=\"right\">Amount</TableCell>\r\n </TableRow>\r\n </TableHeader>\r\n <TableBody>\r\n {data.items.map((item, index) => (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\r\n <TableRow key={index}>\r\n <TableCell>{item.description}</TableCell>\r\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\r\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\r\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toLocaleString()}`}</TableCell>\r\n </TableRow>\r\n ))}\r\n </TableBody>\r\n </Table>\r\n <Section noWrap style={styles.summarySection}>\r\n <View style={styles.summaryLeft}>\r\n <Text style={styles.sectionLabel} noMargin>\r\n Notes & Terms\r\n </Text>\r\n <Text variant=\"xs\" color=\"mutedForeground\">\r\n {data.notes}\r\n </Text>\r\n <Text variant=\"xs\" color=\"mutedForeground\" style={{ marginTop: 4 }}>\r\n GST: {data.paymentTerms.gst}\r\n </Text>\r\n </View>\r\n <View style={styles.summaryRight}>\r\n <KeyValue\r\n size=\"sm\"\r\n dividerThickness={1}\r\n items={[\r\n {\r\n key: \"Subtotal\",\r\n value: `$${data.summary.subtotal.toLocaleString()}`,\r\n },\r\n { key: \"Tax (6.5%)\", value: `$${data.summary.tax.toFixed(2)}` },\r\n {\r\n key: \"Total\",\r\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\r\n value: `$${data.summary.total.toFixed(2)}`,\r\n valueStyle: {\r\n color: theme.colors.accent,\r\n fontSize: 14,\r\n fontWeight: \"bold\",\r\n },\r\n },\r\n ]}\r\n divided\r\n />\r\n </View>\r\n </Section>\r\n <PageFooter\r\n variant=\"centered\"\r\n centerText=\"Thank you for choosing us for your creative needs!\"\r\n sticky\r\n pagePadding={25}\r\n />\r\n </Page>\r\n </Document>\r\n );\r\n};\r\n\r\nexport const InvoiceCreativeDocument = ({\r\n theme,\r\n data = sampleData,\r\n}: {\r\n theme?: PdfcnTheme;\r\n data?: InvoiceCreativeData;\r\n}) => (\r\n <PdfcnThemeProvider theme={theme}>\r\n <InvoiceCreativeContent data={data} />\r\n </PdfcnThemeProvider>\r\n);\r\n",
+ "content": "import { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { InvoiceCreativeData } from \"./invoice-creative.types\";\n\nconst sampleData: InvoiceCreativeData = {\n billTo: {\n address: \"250 Design District, Loft 5\",\n email: \"[email protected]\",\n name: \"Creative Agency Co.\",\n phone: \"+1 (555) 321-7654\",\n },\n companyAddress: \"Nagpur, IN · [email protected]\",\n companyName: \"pdfcn\",\n dueDate: \"March 26, 2026\",\n invoiceDate: \"February 24, 2026\",\n invoiceNumber: \"INV-2026-005\",\n items: [\n { description: \"Brand Identity Design\", quantity: 1, unitPrice: 8500 },\n {\n description: \"Marketing Collateral Package\",\n quantity: 1,\n unitPrice: 4200,\n },\n {\n description: \"Social Media Assets (per set)\",\n quantity: 4,\n unitPrice: 750,\n },\n { description: \"Motion Graphics (30s)\", quantity: 2, unitPrice: 3500 },\n ],\n notes:\n \"Creative work is protected under copyright. Full usage rights transfer upon payment.\",\n paymentTerms: {\n dueDate: \"March 26, 2026\",\n gst: \"GSTIN 456789123\",\n method: \"Credit Card / PayPal / Stripe\",\n },\n subtitle: \"Innovative PDF Solutions\",\n summary: {\n subtotal: 22_700,\n tax: 1475.5,\n total: 24_175.5,\n },\n};\n\nconst InvoiceCreativeContent = ({ data }: { data: InvoiceCreativeData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n accentBlock: {\n backgroundColor: theme.colors.muted,\n borderLeftColor: theme.colors.accent,\n borderLeftStyle: \"solid\",\n borderLeftWidth: 4,\n marginBottom: theme.spacing.sectionGap,\n paddingLeft: 14,\n paddingVertical: 10,\n },\n badgeLabel: {\n color: theme.colors.primaryForeground,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n badgeNumber: {\n color: theme.colors.primaryForeground,\n fontSize: 16,\n fontWeight: \"bold\",\n },\n heroSection: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: theme.spacing.sectionGap,\n },\n infoColumn: {\n flex: 1,\n },\n infoGrid: {\n flexDirection: \"row\",\n gap: 32,\n },\n invoiceBadge: {\n alignItems: \"center\",\n backgroundColor: theme.colors.primary,\n borderRadius: theme.primitives.borderRadius.md,\n paddingHorizontal: 20,\n paddingVertical: 14,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n sectionLabel: {\n color: theme.colors.accent,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.8,\n marginBottom: 6,\n textTransform: \"uppercase\",\n },\n summaryLeft: {\n flex: 1,\n paddingRight: 20,\n },\n summaryRight: {\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.sm,\n padding: 14,\n width: 240,\n },\n summarySection: {\n flexDirection: \"row\",\n marginTop: 24,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <View style={styles.heroSection}>\n <View style={{ flex: 1 }}>\n <PageHeader\n variant=\"centered\"\n title={data.companyName}\n subtitle={`${data.subtitle} · ${data.companyAddress}`}\n marginBottom={0}\n />\n </View>\n <View style={styles.invoiceBadge}>\n <Text style={styles.badgeLabel} noMargin>\n Invoice\n </Text>\n <Text style={styles.badgeNumber} noMargin>\n {data.invoiceNumber}\n </Text>\n </View>\n </View>\n <View style={styles.accentBlock}>\n <View style={styles.infoGrid}>\n <View style={styles.infoColumn}>\n <Text style={styles.sectionLabel} noMargin>\n Billed To\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.billTo.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.email} · {data.billTo.phone}\n </Text>\n </View>\n <View style={styles.infoColumn}>\n <Text style={styles.sectionLabel} noMargin>\n Invoice Info\n </Text>\n <KeyValue\n size=\"sm\"\n items={[\n { key: \"Issue Date\", value: data.invoiceDate },\n { key: \"Due Date\", value: data.dueDate },\n { key: \"Payment\", value: data.paymentTerms.method },\n ]}\n />\n </View>\n </View>\n </View>\n <Table variant=\"striped\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Deliverable</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Rate</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toLocaleString()}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={styles.summarySection}>\n <View style={styles.summaryLeft}>\n <Text style={styles.sectionLabel} noMargin>\n Notes & Terms\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\">\n {data.notes}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" style={{ marginTop: 4 }}>\n GST: {data.paymentTerms.gst}\n </Text>\n </View>\n <View style={styles.summaryRight}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toLocaleString()}`,\n },\n { key: \"Tax (6.5%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Total\",\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.accent,\n fontSize: 14,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </Section>\n <PageFooter\n variant=\"centered\"\n centerText=\"Thank you for choosing us for your creative needs!\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceCreativeDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceCreativeData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceCreativeContent data={data} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-creative/invoice-creative.tsx"
},
{
"path": "registry/bases/takumi/blocks/invoice-creative/invoice-creative.types.ts",
- "content": "export interface InvoiceCreativeData {\r\n invoiceNumber: string;\r\n invoiceDate: string;\r\n dueDate: string;\r\n companyName: string;\r\n subtitle: string;\r\n companyAddress: string;\r\n billTo: {\r\n name: string;\r\n address: string;\r\n email: string;\r\n phone: string;\r\n };\r\n items: {\r\n description: string;\r\n quantity: number;\r\n unitPrice: number;\r\n }[];\r\n summary: {\r\n subtotal: number;\r\n tax: number;\r\n total: number;\r\n };\r\n paymentTerms: {\r\n dueDate: string;\r\n method: string;\r\n gst: string;\r\n };\r\n notes?: string;\r\n}\r\n",
+ "content": "export interface InvoiceCreativeData {\n invoiceNumber: string;\n invoiceDate: string;\n dueDate: string;\n companyName: string;\n subtitle: string;\n companyAddress: string;\n billTo: {\n name: string;\n address: string;\n email: string;\n phone: string;\n };\n items: {\n description: string;\n quantity: number;\n unitPrice: number;\n }[];\n summary: {\n subtotal: number;\n tax: number;\n total: number;\n };\n paymentTerms: {\n dueDate: string;\n method: string;\n gst: string;\n };\n notes?: string;\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-creative/invoice-creative.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/invoice-minimal.json b/apps/web/public/r/takumi/invoice-minimal.json
index 27844d8..adfe147 100644
--- a/apps/web/public/r/takumi/invoice-minimal.json
+++ b/apps/web/public/r/takumi/invoice-minimal.json
@@ -19,16 +19,16 @@
"files": [
{
"path": "registry/bases/takumi/blocks/invoice-minimal/invoice-minimal.tsx",
- "content": "import { KeyValue } from \"@/registry/bases/takumi/components/key-value/key-value\";\r\nimport { PageFooter } from \"@/registry/bases/takumi/components/page-footer/page-footer\";\r\nimport { PageHeader } from \"@/registry/bases/takumi/components/page-header/page-header\";\r\nimport { Section } from \"@/registry/bases/takumi/components/section/section\";\r\nimport {\r\n Table,\r\n TableBody,\r\n TableCell,\r\n TableHeader,\r\n TableRow,\r\n} from \"@/registry/bases/takumi/components/table/table\";\r\nimport { Text } from \"@/registry/bases/takumi/components/text/text\";\r\nimport {\r\n PdfcnThemeProvider,\r\n usePdfcnTheme,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n StyleSheet,\r\n Document,\r\n Page,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { InvoiceMinimalData } from \"./invoice-minimal.types\";\r\n\r\n// Sample data — replace with your own props or data source\r\nconst sampleData: InvoiceMinimalData = {\r\n billTo: {\r\n address: \"500 Enterprise Way, Building A\",\r\n email: \"[email protected]\",\r\n name: \"Enterprise Corp\",\r\n phone: \"+1 (555) 246-8135\",\r\n },\r\n companyAddress: \"Nagpur, IN\",\r\n companyEmail: \"[email protected]\",\r\n companyName: \"pdfcn\",\r\n dueDate: \"March 22, 2026\",\r\n invoiceDate: \"February 20, 2026\",\r\n invoiceNumber: \"INV-2026-003\",\r\n items: [\r\n { description: \"Annual License Plan\", quantity: 1, unitPrice: 25_000 },\r\n { description: \"Support & Maintenance\", quantity: 12, unitPrice: 1500 },\r\n { description: \"Custom Integration\", quantity: 1, unitPrice: 12_000 },\r\n ],\r\n notes:\r\n \"Invoice for annual enterprise subscription. Please retain for your records.\",\r\n paymentTerms: {\r\n dueDate: \"March 22, 2026\",\r\n gst: \"GSTIN 123456789\",\r\n method: \"ACH Transfer / Check\",\r\n },\r\n subtitle: \"Innovative PDF Solutions\",\r\n summary: {\r\n subtotal: 55_000,\r\n tax: 3850,\r\n total: 58_850,\r\n },\r\n};\r\n\r\nconst InvoiceMinimalContent = ({ data }: { data: InvoiceMinimalData }) => {\r\n const theme = usePdfcnTheme();\r\n\r\n const styles = StyleSheet.create({\r\n infoLabel: {\r\n color: theme.colors.primary,\r\n fontSize: 8,\r\n fontWeight: \"bold\",\r\n letterSpacing: 0.8,\r\n marginBottom: 4,\r\n textTransform: \"uppercase\",\r\n },\r\n infoRow: {\r\n flexDirection: \"row\",\r\n marginBottom: theme.spacing.sectionGap,\r\n },\r\n invoiceStamp: {\r\n alignSelf: \"flex-start\",\r\n borderColor: theme.colors.primary,\r\n borderRadius: theme.primitives.borderRadius.sm,\r\n borderStyle: \"solid\",\r\n borderWidth: 2,\r\n paddingHorizontal: 12,\r\n paddingVertical: 8,\r\n },\r\n page: {\r\n backgroundColor: theme.colors.background,\r\n boxSizing: \"border-box\",\r\n minHeight: 841,\r\n padding: theme.spacing.page.marginTop,\r\n paddingBottom: theme.spacing.page.marginBottom,\r\n position: \"relative\",\r\n },\r\n });\r\n\r\n return (\r\n <Document title={`Invoice ${data.invoiceNumber}`}>\r\n <Page size=\"A4\" style={styles.page}>\r\n <Section\r\n noWrap\r\n style={{\r\n alignItems: \"flex-start\",\r\n flexDirection: \"row\",\r\n marginBottom: theme.spacing.sectionGap,\r\n }}\r\n >\r\n <View style={{ flex: 1 }}>\r\n <PageHeader\r\n variant=\"minimal\"\r\n title={data.companyName}\r\n subtitle={`${data.companyAddress} · ${data.companyEmail}`}\r\n marginBottom={0}\r\n />\r\n </View>\r\n <View style={styles.invoiceStamp}>\r\n <Text\r\n style={{\r\n color: theme.colors.primary,\r\n fontSize: 7,\r\n fontWeight: \"bold\",\r\n textAlign: \"right\",\r\n }}\r\n noMargin\r\n transform=\"uppercase\"\r\n >\r\n Invoice\r\n </Text>\r\n <Text\r\n style={{\r\n color: theme.colors.foreground,\r\n fontSize: 14,\r\n fontWeight: \"bold\",\r\n textAlign: \"right\",\r\n }}\r\n noMargin\r\n >\r\n {data.invoiceNumber}\r\n </Text>\r\n <Text\r\n style={{\r\n color: theme.colors.mutedForeground,\r\n fontSize: 8,\r\n textAlign: \"right\",\r\n }}\r\n noMargin\r\n >\r\n {data.invoiceDate}\r\n </Text>\r\n </View>\r\n </Section>\r\n <View style={styles.infoRow}>\r\n <View style={{ paddingRight: 20, width: \"50%\" }}>\r\n <Text style={styles.infoLabel} noMargin>\r\n Bill To\r\n </Text>\r\n <Text variant=\"sm\" noMargin>\r\n {data.billTo.name}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.billTo.address}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.billTo.email}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.billTo.phone}\r\n </Text>\r\n </View>\r\n <View style={{ width: \"50%\" }}>\r\n <Text style={styles.infoLabel} noMargin>\r\n Invoice Details\r\n </Text>\r\n <KeyValue\r\n size=\"sm\"\r\n items={[\r\n { key: \"Due Date\", value: data.dueDate },\r\n { key: \"Payment\", value: data.paymentTerms.method },\r\n { key: \"GST\", value: data.paymentTerms.gst },\r\n ]}\r\n />\r\n </View>\r\n </View>\r\n <Table variant=\"compact\">\r\n <TableHeader>\r\n <TableRow header>\r\n <TableCell>Description</TableCell>\r\n <TableCell align=\"center\">Qty</TableCell>\r\n <TableCell align=\"right\">Rate</TableCell>\r\n <TableCell align=\"right\">Total</TableCell>\r\n </TableRow>\r\n </TableHeader>\r\n <TableBody>\r\n {data.items.map((item, index) => (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\r\n <TableRow key={index}>\r\n <TableCell>{item.description}</TableCell>\r\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\r\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\r\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\r\n </TableRow>\r\n ))}\r\n </TableBody>\r\n </Table>\r\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 20 }}>\r\n <View style={{ flex: 1 }} />\r\n <View style={{ width: 240 }}>\r\n <KeyValue\r\n size=\"sm\"\r\n dividerThickness={1}\r\n items={[\r\n {\r\n key: \"Subtotal\",\r\n value: `$${data.summary.subtotal.toFixed(2)}`,\r\n },\r\n { key: \"Tax (7%)\", value: `$${data.summary.tax.toFixed(2)}` },\r\n {\r\n key: \"Balance Due\",\r\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\r\n value: `$${data.summary.total.toFixed(2)}`,\r\n valueStyle: {\r\n color: theme.colors.primary,\r\n fontSize: 13,\r\n fontWeight: \"bold\",\r\n },\r\n },\r\n ]}\r\n divided\r\n />\r\n </View>\r\n </Section>\r\n <PageFooter\r\n leftText={data.notes}\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={25}\r\n />\r\n </Page>\r\n </Document>\r\n );\r\n};\r\n\r\nexport const InvoiceMinimalDocument = ({\r\n theme,\r\n data = sampleData,\r\n}: {\r\n theme?: PdfcnTheme;\r\n data?: InvoiceMinimalData;\r\n}) => (\r\n <PdfcnThemeProvider theme={theme}>\r\n <InvoiceMinimalContent data={data} />\r\n </PdfcnThemeProvider>\r\n);\r\n",
+ "content": "import { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { InvoiceMinimalData } from \"./invoice-minimal.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: InvoiceMinimalData = {\n billTo: {\n address: \"500 Enterprise Way, Building A\",\n email: \"[email protected]\",\n name: \"Enterprise Corp\",\n phone: \"+1 (555) 246-8135\",\n },\n companyAddress: \"Nagpur, IN\",\n companyEmail: \"[email protected]\",\n companyName: \"pdfcn\",\n dueDate: \"March 22, 2026\",\n invoiceDate: \"February 20, 2026\",\n invoiceNumber: \"INV-2026-003\",\n items: [\n { description: \"Annual License Plan\", quantity: 1, unitPrice: 25_000 },\n { description: \"Support & Maintenance\", quantity: 12, unitPrice: 1500 },\n { description: \"Custom Integration\", quantity: 1, unitPrice: 12_000 },\n ],\n notes:\n \"Invoice for annual enterprise subscription. Please retain for your records.\",\n paymentTerms: {\n dueDate: \"March 22, 2026\",\n gst: \"GSTIN 123456789\",\n method: \"ACH Transfer / Check\",\n },\n subtitle: \"Innovative PDF Solutions\",\n summary: {\n subtotal: 55_000,\n tax: 3850,\n total: 58_850,\n },\n};\n\nconst InvoiceMinimalContent = ({ data }: { data: InvoiceMinimalData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n infoLabel: {\n color: theme.colors.primary,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.8,\n marginBottom: 4,\n textTransform: \"uppercase\",\n },\n infoRow: {\n flexDirection: \"row\",\n marginBottom: theme.spacing.sectionGap,\n },\n invoiceStamp: {\n alignSelf: \"flex-start\",\n borderColor: theme.colors.primary,\n borderRadius: theme.primitives.borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: 2,\n paddingHorizontal: 12,\n paddingVertical: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <Section\n noWrap\n style={{\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n marginBottom: theme.spacing.sectionGap,\n }}\n >\n <View style={{ flex: 1 }}>\n <PageHeader\n variant=\"minimal\"\n title={data.companyName}\n subtitle={`${data.companyAddress} · ${data.companyEmail}`}\n marginBottom={0}\n />\n </View>\n <View style={styles.invoiceStamp}>\n <Text\n style={{\n color: theme.colors.primary,\n fontSize: 7,\n fontWeight: \"bold\",\n textAlign: \"right\",\n }}\n noMargin\n transform=\"uppercase\"\n >\n Invoice\n </Text>\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: \"bold\",\n textAlign: \"right\",\n }}\n noMargin\n >\n {data.invoiceNumber}\n </Text>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 8,\n textAlign: \"right\",\n }}\n noMargin\n >\n {data.invoiceDate}\n </Text>\n </View>\n </Section>\n <View style={styles.infoRow}>\n <View style={{ paddingRight: 20, width: \"50%\" }}>\n <Text style={styles.infoLabel} noMargin>\n Bill To\n </Text>\n <Text variant=\"sm\" noMargin>\n {data.billTo.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.email}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.phone}\n </Text>\n </View>\n <View style={{ width: \"50%\" }}>\n <Text style={styles.infoLabel} noMargin>\n Invoice Details\n </Text>\n <KeyValue\n size=\"sm\"\n items={[\n { key: \"Due Date\", value: data.dueDate },\n { key: \"Payment\", value: data.paymentTerms.method },\n { key: \"GST\", value: data.paymentTerms.gst },\n ]}\n />\n </View>\n </View>\n <Table variant=\"compact\">\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Rate</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 20 }}>\n <View style={{ flex: 1 }} />\n <View style={{ width: 240 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toFixed(2)}`,\n },\n { key: \"Tax (7%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Balance Due\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.primary,\n fontSize: 13,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </Section>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceMinimalDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceMinimalData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceMinimalContent data={data} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-minimal/invoice-minimal.tsx"
},
{
"path": "registry/bases/takumi/blocks/invoice-minimal/invoice-minimal.types.ts",
- "content": "export interface InvoiceMinimalData {\r\n invoiceNumber: string;\r\n invoiceDate: string;\r\n dueDate: string;\r\n companyName: string;\r\n subtitle: string;\r\n companyAddress: string;\r\n companyEmail: string;\r\n billTo: {\r\n name: string;\r\n address: string;\r\n email: string;\r\n phone: string;\r\n };\r\n items: {\r\n description: string;\r\n quantity: number;\r\n unitPrice: number;\r\n }[];\r\n summary: {\r\n subtotal: number;\r\n tax: number;\r\n total: number;\r\n };\r\n paymentTerms: {\r\n dueDate: string;\r\n method: string;\r\n gst: string;\r\n };\r\n notes?: string;\r\n}\r\n",
+ "content": "export interface InvoiceMinimalData {\n invoiceNumber: string;\n invoiceDate: string;\n dueDate: string;\n companyName: string;\n subtitle: string;\n companyAddress: string;\n companyEmail: string;\n billTo: {\n name: string;\n address: string;\n email: string;\n phone: string;\n };\n items: {\n description: string;\n quantity: number;\n unitPrice: number;\n }[];\n summary: {\n subtotal: number;\n tax: number;\n total: number;\n };\n paymentTerms: {\n dueDate: string;\n method: string;\n gst: string;\n };\n notes?: string;\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-minimal/invoice-minimal.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/invoice-modern.json b/apps/web/public/r/takumi/invoice-modern.json
index 894f52a..94c1337 100644
--- a/apps/web/public/r/takumi/invoice-modern.json
+++ b/apps/web/public/r/takumi/invoice-modern.json
@@ -19,16 +19,16 @@
"files": [
{
"path": "registry/bases/takumi/blocks/invoice-modern/invoice-modern.tsx",
- "content": "import { KeyValue } from \"@/registry/bases/takumi/components/key-value/key-value\";\r\nimport { PageFooter } from \"@/registry/bases/takumi/components/page-footer/page-footer\";\r\nimport { PageHeader } from \"@/registry/bases/takumi/components/page-header/page-header\";\r\nimport { Section } from \"@/registry/bases/takumi/components/section/section\";\r\nimport {\r\n Table,\r\n TableBody,\r\n TableCell,\r\n TableHeader,\r\n TableRow,\r\n} from \"@/registry/bases/takumi/components/table/table\";\r\nimport { Text } from \"@/registry/bases/takumi/components/text/text\";\r\nimport {\r\n PdfcnThemeProvider,\r\n usePdfcnTheme,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n StyleSheet,\r\n Document,\r\n Page,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { InvoiceModernData } from \"./invoice-modern.types\";\r\n\r\n// Sample data — replace with your own props or data source\r\nconst sampleData: InvoiceModernData = {\r\n billTo: {\r\n address: \"789 Innovation Blvd, Floor 3\",\r\n email: \"[email protected]\",\r\n name: \"TechStart Solutions\",\r\n phone: \"+1 (555) 987-6543\",\r\n },\r\n companyAddress: \"Nagpur, IN\",\r\n companyEmail: \"[email protected]\",\r\n companyName: \"pdfcn\",\r\n dueDate: \"March 20, 2026\",\r\n invoiceDate: \"February 18, 2026\",\r\n invoiceNumber: \"INV-2026-002\",\r\n items: [\r\n { description: \"API Integration\", quantity: 1, unitPrice: 15_000 },\r\n { description: \"SEO\", quantity: 2, unitPrice: 5500 },\r\n { description: \"Security Audit\", quantity: 1, unitPrice: 7200 },\r\n ],\r\n notes: \"Payment terms: Net 30 days. Thank you for your business!\",\r\n paymentTerms: {\r\n dueDate: \"March 20, 2026\",\r\n gst: \"GSTIN 123456789\",\r\n method: \"Wire Transfer / Bank Account\",\r\n },\r\n subtitle: \"Innovative PDF Solutions\",\r\n summary: {\r\n subtotal: 33_200,\r\n tax: 2324,\r\n total: 35_524,\r\n },\r\n};\r\n\r\nconst InvoiceModernContent = ({ data }: { data: InvoiceModernData }) => {\r\n const theme = usePdfcnTheme();\r\n\r\n const styles = StyleSheet.create({\r\n dividerCol: {\r\n backgroundColor: theme.colors.border,\r\n marginRight: 12,\r\n width: 1,\r\n },\r\n metaCol: {\r\n flex: 1,\r\n paddingRight: 12,\r\n },\r\n metaLabel: {\r\n color: theme.colors.mutedForeground,\r\n fontSize: 8,\r\n fontWeight: \"bold\",\r\n letterSpacing: 0.5,\r\n marginBottom: 3,\r\n textTransform: \"uppercase\",\r\n },\r\n metaRow: {\r\n flexDirection: \"row\",\r\n marginBottom: theme.spacing.sectionGap,\r\n },\r\n metaValue: {\r\n color: theme.colors.foreground,\r\n fontSize: 9,\r\n },\r\n page: {\r\n backgroundColor: theme.colors.background,\r\n boxSizing: \"border-box\",\r\n minHeight: 841,\r\n padding: theme.spacing.page.marginTop,\r\n paddingBottom: theme.spacing.page.marginBottom,\r\n position: \"relative\",\r\n },\r\n });\r\n\r\n return (\r\n <Document title={`Invoice ${data.invoiceNumber}`}>\r\n <Page size=\"A4\" style={styles.page}>\r\n <PageHeader\r\n variant=\"branded\"\r\n title={data.companyName}\r\n subtitle={`${data.subtitle} · ${data.companyAddress} · ${data.companyEmail}`}\r\n />\r\n <View style={styles.metaRow}>\r\n <View style={styles.metaCol}>\r\n <Text style={styles.metaLabel} noMargin>\r\n Invoice Number\r\n </Text>\r\n <Text\r\n style={{ ...styles.metaValue, fontSize: 11, fontWeight: \"bold\" }}\r\n noMargin\r\n >\r\n {data.invoiceNumber}\r\n </Text>\r\n </View>\r\n <View style={styles.metaCol}>\r\n <Text style={styles.metaLabel} noMargin>\r\n Invoice Date\r\n </Text>\r\n <Text style={styles.metaValue} noMargin>\r\n {data.invoiceDate}\r\n </Text>\r\n </View>\r\n <View style={styles.metaCol}>\r\n <Text style={styles.metaLabel} noMargin>\r\n Due Date\r\n </Text>\r\n <Text style={styles.metaValue} noMargin>\r\n {data.dueDate}\r\n </Text>\r\n </View>\r\n <View style={styles.dividerCol} />\r\n <View style={{ flex: 2 }}>\r\n <Text style={styles.metaLabel} noMargin>\r\n Billed To\r\n </Text>\r\n <Text style={{ ...styles.metaValue, fontWeight: \"bold\" }} noMargin>\r\n {data.billTo.name}\r\n </Text>\r\n <Text\r\n style={{\r\n ...styles.metaValue,\r\n color: theme.colors.mutedForeground,\r\n }}\r\n noMargin\r\n >\r\n {data.billTo.address}\r\n </Text>\r\n <Text\r\n style={{\r\n ...styles.metaValue,\r\n color: theme.colors.mutedForeground,\r\n }}\r\n noMargin\r\n >\r\n {data.billTo.email}\r\n </Text>\r\n <Text\r\n style={{\r\n ...styles.metaValue,\r\n color: theme.colors.mutedForeground,\r\n }}\r\n noMargin\r\n >\r\n {data.billTo.phone}\r\n </Text>\r\n </View>\r\n </View>\r\n <Table variant=\"primary-header\">\r\n <TableHeader>\r\n <TableRow header>\r\n <TableCell>Description</TableCell>\r\n <TableCell align=\"center\">Qty</TableCell>\r\n <TableCell align=\"right\">Unit Price</TableCell>\r\n <TableCell align=\"right\">Amount</TableCell>\r\n </TableRow>\r\n </TableHeader>\r\n <TableBody>\r\n {data.items.map((item, index) => (\r\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\r\n <TableRow key={index}>\r\n <TableCell>{item.description}</TableCell>\r\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\r\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\r\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\r\n </TableRow>\r\n ))}\r\n </TableBody>\r\n </Table>\r\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 16 }}>\r\n <View style={{ flex: 1, paddingRight: 20 }}>\r\n <Text style={styles.metaLabel} noMargin>\r\n Payment Method\r\n </Text>\r\n <Text variant=\"xs\" noMargin>\r\n {data.paymentTerms.method}\r\n </Text>\r\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\r\n {data.paymentTerms.gst}\r\n </Text>\r\n </View>\r\n <View style={{ width: 220 }}>\r\n <KeyValue\r\n size=\"sm\"\r\n dividerThickness={1}\r\n items={[\r\n {\r\n key: \"Subtotal\",\r\n value: `$${data.summary.subtotal.toFixed(2)}`,\r\n },\r\n { key: \"Tax (7%)\", value: `$${data.summary.tax.toFixed(2)}` },\r\n {\r\n key: \"Total Due\",\r\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\r\n value: `$${data.summary.total.toFixed(2)}`,\r\n valueStyle: { fontSize: 12, fontWeight: \"bold\" },\r\n },\r\n ]}\r\n divided\r\n />\r\n </View>\r\n </Section>\r\n <PageFooter\r\n leftText={data.notes}\r\n rightText=\"Page 1 of 1\"\r\n sticky\r\n pagePadding={25}\r\n />\r\n </Page>\r\n </Document>\r\n );\r\n};\r\n\r\nexport const InvoiceModernDocument = ({\r\n theme,\r\n data = sampleData,\r\n}: {\r\n theme?: PdfcnTheme;\r\n data?: InvoiceModernData;\r\n}) => (\r\n <PdfcnThemeProvider theme={theme}>\r\n <InvoiceModernContent data={data} />\r\n </PdfcnThemeProvider>\r\n);\r\n",
+ "content": "import { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { InvoiceModernData } from \"./invoice-modern.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: InvoiceModernData = {\n billTo: {\n address: \"789 Innovation Blvd, Floor 3\",\n email: \"[email protected]\",\n name: \"TechStart Solutions\",\n phone: \"+1 (555) 987-6543\",\n },\n companyAddress: \"Nagpur, IN\",\n companyEmail: \"[email protected]\",\n companyName: \"pdfcn\",\n dueDate: \"March 20, 2026\",\n invoiceDate: \"February 18, 2026\",\n invoiceNumber: \"INV-2026-002\",\n items: [\n { description: \"API Integration\", quantity: 1, unitPrice: 15_000 },\n { description: \"SEO\", quantity: 2, unitPrice: 5500 },\n { description: \"Security Audit\", quantity: 1, unitPrice: 7200 },\n ],\n notes: \"Payment terms: Net 30 days. Thank you for your business!\",\n paymentTerms: {\n dueDate: \"March 20, 2026\",\n gst: \"GSTIN 123456789\",\n method: \"Wire Transfer / Bank Account\",\n },\n subtitle: \"Innovative PDF Solutions\",\n summary: {\n subtotal: 33_200,\n tax: 2324,\n total: 35_524,\n },\n};\n\nconst InvoiceModernContent = ({ data }: { data: InvoiceModernData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n dividerCol: {\n backgroundColor: theme.colors.border,\n marginRight: 12,\n width: 1,\n },\n metaCol: {\n flex: 1,\n paddingRight: 12,\n },\n metaLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.5,\n marginBottom: 3,\n textTransform: \"uppercase\",\n },\n metaRow: {\n flexDirection: \"row\",\n marginBottom: theme.spacing.sectionGap,\n },\n metaValue: {\n color: theme.colors.foreground,\n fontSize: 9,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"branded\"\n title={data.companyName}\n subtitle={`${data.subtitle} · ${data.companyAddress} · ${data.companyEmail}`}\n />\n <View style={styles.metaRow}>\n <View style={styles.metaCol}>\n <Text style={styles.metaLabel} noMargin>\n Invoice Number\n </Text>\n <Text\n style={{ ...styles.metaValue, fontSize: 11, fontWeight: \"bold\" }}\n noMargin\n >\n {data.invoiceNumber}\n </Text>\n </View>\n <View style={styles.metaCol}>\n <Text style={styles.metaLabel} noMargin>\n Invoice Date\n </Text>\n <Text style={styles.metaValue} noMargin>\n {data.invoiceDate}\n </Text>\n </View>\n <View style={styles.metaCol}>\n <Text style={styles.metaLabel} noMargin>\n Due Date\n </Text>\n <Text style={styles.metaValue} noMargin>\n {data.dueDate}\n </Text>\n </View>\n <View style={styles.dividerCol} />\n <View style={{ flex: 2 }}>\n <Text style={styles.metaLabel} noMargin>\n Billed To\n </Text>\n <Text style={{ ...styles.metaValue, fontWeight: \"bold\" }} noMargin>\n {data.billTo.name}\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n color: theme.colors.mutedForeground,\n }}\n noMargin\n >\n {data.billTo.address}\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n color: theme.colors.mutedForeground,\n }}\n noMargin\n >\n {data.billTo.email}\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n color: theme.colors.mutedForeground,\n }}\n noMargin\n >\n {data.billTo.phone}\n </Text>\n </View>\n </View>\n <Table variant=\"primary-header\">\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Unit Price</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 16 }}>\n <View style={{ flex: 1, paddingRight: 20 }}>\n <Text style={styles.metaLabel} noMargin>\n Payment Method\n </Text>\n <Text variant=\"xs\" noMargin>\n {data.paymentTerms.method}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.paymentTerms.gst}\n </Text>\n </View>\n <View style={{ width: 220 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toFixed(2)}`,\n },\n { key: \"Tax (7%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Total Due\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: { fontSize: 12, fontWeight: \"bold\" },\n },\n ]}\n divided\n />\n </View>\n </Section>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceModernDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceModernData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceModernContent data={data} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-modern/invoice-modern.tsx"
},
{
"path": "registry/bases/takumi/blocks/invoice-modern/invoice-modern.types.ts",
- "content": "export interface InvoiceModernData {\r\n invoiceNumber: string;\r\n invoiceDate: string;\r\n dueDate: string;\r\n companyName: string;\r\n subtitle: string;\r\n companyAddress: string;\r\n companyEmail: string;\r\n billTo: {\r\n name: string;\r\n address: string;\r\n email: string;\r\n phone: string;\r\n };\r\n items: {\r\n description: string;\r\n quantity: number;\r\n unitPrice: number;\r\n }[];\r\n summary: {\r\n subtotal: number;\r\n tax: number;\r\n total: number;\r\n };\r\n paymentTerms: {\r\n dueDate: string;\r\n method: string;\r\n gst: string;\r\n };\r\n notes?: string;\r\n}\r\n",
+ "content": "export interface InvoiceModernData {\n invoiceNumber: string;\n invoiceDate: string;\n dueDate: string;\n companyName: string;\n subtitle: string;\n companyAddress: string;\n companyEmail: string;\n billTo: {\n name: string;\n address: string;\n email: string;\n phone: string;\n };\n items: {\n description: string;\n quantity: number;\n unitPrice: number;\n }[];\n summary: {\n subtotal: number;\n tax: number;\n total: number;\n };\n paymentTerms: {\n dueDate: string;\n method: string;\n gst: string;\n };\n notes?: string;\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/invoice-modern/invoice-modern.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/keep-together.json b/apps/web/public/r/takumi/keep-together.json
index 15a0f1d..cbaff3f 100644
--- a/apps/web/public/r/takumi/keep-together.json
+++ b/apps/web/public/r/takumi/keep-together.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/takumi/components/keep-together/keep-together.tsx",
- "content": "import type { ReactNode } from \"react\";\r\n\r\nimport { View } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/types/pdf-components\";\r\n\r\nexport interface KeepTogetherProps {\r\n children?: ReactNode;\r\n minPresenceAhead?: number;\r\n style?: Style;\r\n}\r\n\r\nexport const KeepTogether = ({ children, style }: KeepTogetherProps) => (\r\n <View style={[{ breakInside: \"avoid\" }, style].filter(Boolean) as never}>\r\n {children}\r\n </View>\r\n);\r\n",
+ "content": "import type { ReactNode } from \"react\";\n\nimport { View } from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/types/pdf-components\";\n\nexport interface KeepTogetherProps {\n children?: ReactNode;\n minPresenceAhead?: number;\n style?: Style;\n}\n\nexport const KeepTogether = ({ children, style }: KeepTogetherProps) => (\n <View style={[{ breakInside: \"avoid\" }, style].filter(Boolean) as never}>\n {children}\n </View>\n);\n",
"type": "registry:component",
"target": "components/pdf/keep-together/keep-together.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/key-value.json b/apps/web/public/r/takumi/key-value.json
index 23b88f4..7017bf3 100644
--- a/apps/web/public/r/takumi/key-value.json
+++ b/apps/web/public/r/takumi/key-value.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/takumi/components/key-value/key-value.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n Text as PDFText,\r\n StyleSheet,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type KeyValueDirection = \"horizontal\" | \"vertical\";\r\nexport type KeyValueSize = \"sm\" | \"md\" | \"lg\";\r\n\r\n/**\r\n * A single key-value row with optional per-item color and style overrides.\r\n * Props - `key` | `value` | `valueColor` | `valueStyle` | `keyStyle`\r\n * @see {@link KeyValueEntry}\r\n */\r\nexport interface KeyValueEntry {\r\n key: string;\r\n value: string;\r\n valueColor?: string;\r\n valueStyle?: Style;\r\n keyStyle?: Style;\r\n}\r\n\r\n/**\r\n * List of key-value pairs with layout and style options.\r\n * Props - `items` | `direction` | `divided` | `size` | `labelFlex` | `labelColor` | `valueColor` | `boldValue` | `noWrap` | `dividerColor` | `dividerThickness` | `dividerMargin` | `style`\r\n * @see {@link KeyValueProps}\r\n */\r\nexport interface KeyValueProps extends Omit<PDFComponentProps, \"children\"> {\r\n items: KeyValueEntry[];\r\n /**\r\n * @default 'horizontal'\r\n */\r\n direction?: KeyValueDirection;\r\n /**\r\n * @default false\r\n */\r\n divided?: boolean;\r\n /**\r\n * @default 'md'\r\n */\r\n size?: KeyValueSize;\r\n /**\r\n * @default 1\r\n */\r\n labelFlex?: number;\r\n labelColor?: string;\r\n valueColor?: string;\r\n /**\r\n * @default false\r\n */\r\n boldValue?: boolean;\r\n /**\r\n * @default false\r\n */\r\n noWrap?: boolean;\r\n dividerColor?: string;\r\n dividerThickness?: number;\r\n dividerMargin?: number;\r\n}\r\n\r\nconst createKeyValueStyles = (t: PdfcnTheme) => {\r\n const { spacing, fontWeights } = t.primitives;\r\n const c = t.colors;\r\n const { body } = t.typography;\r\n const keyBase = {\r\n color: c.mutedForeground,\r\n fontFamily: body.fontFamily,\r\n fontWeight: fontWeights.medium,\r\n };\r\n const valueBase = {\r\n color: c.foreground,\r\n fontFamily: body.fontFamily,\r\n fontWeight: fontWeights.regular,\r\n };\r\n return StyleSheet.create({\r\n container: { flexDirection: \"column\" },\r\n divider: {\r\n borderBottomColor: c.border,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: spacing[0.5],\r\n },\r\n keyLg: { ...keyBase, fontSize: t.primitives.typography.base },\r\n keyMd: { ...keyBase, fontSize: body.fontSize },\r\n keySm: { ...keyBase, fontSize: t.primitives.typography.xs },\r\n rowHorizontal: {\r\n alignItems: \"flex-start\",\r\n flexDirection: \"row\",\r\n paddingVertical: spacing[1],\r\n },\r\n rowVertical: {\r\n flexDirection: \"column\",\r\n marginBottom: t.spacing.paragraphGap,\r\n },\r\n valueBold: { fontWeight: fontWeights.bold },\r\n valueLg: { ...valueBase, fontSize: t.primitives.typography.base },\r\n valueMd: { ...valueBase, fontSize: body.fontSize },\r\n valueSm: { ...valueBase, fontSize: t.primitives.typography.xs },\r\n });\r\n};\r\n\r\nexport const KeyValue = ({\r\n items,\r\n direction = \"horizontal\",\r\n divided = false,\r\n size = \"md\",\r\n labelFlex = 1,\r\n labelColor,\r\n valueColor,\r\n boldValue = false,\r\n noWrap = false,\r\n dividerColor,\r\n dividerThickness,\r\n dividerMargin,\r\n style,\r\n}: KeyValueProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createKeyValueStyles(theme), [theme]);\r\n const keyStyleMap = {\r\n lg: styles.keyLg,\r\n md: styles.keyMd,\r\n sm: styles.keySm,\r\n } as Record<KeyValueSize, Style>;\r\n const valueStyleMap = {\r\n lg: styles.valueLg,\r\n md: styles.valueMd,\r\n sm: styles.valueSm,\r\n } as Record<KeyValueSize, Style>;\r\n const containerStyles: Style[] = [styles.container];\r\n if (style) {\r\n containerStyles.push(...[style].flat());\r\n }\r\n\r\n return (\r\n <View wrap={!noWrap} style={containerStyles}>\r\n {items.map((item, index) => {\r\n const isLast = index === items.length - 1;\r\n const keyStyles: Style[] = [keyStyleMap[size]];\r\n if (labelColor) {\r\n keyStyles.push({ color: resolveColor(labelColor, theme.colors) });\r\n }\r\n if (item.keyStyle) {\r\n keyStyles.push(item.keyStyle);\r\n }\r\n const valStyles: Style[] = [valueStyleMap[size]];\r\n if (boldValue) {\r\n valStyles.push(styles.valueBold);\r\n }\r\n const resolvedValueColor = item.valueColor ?? valueColor;\r\n if (resolvedValueColor) {\r\n valStyles.push({\r\n color: resolveColor(resolvedValueColor, theme.colors),\r\n });\r\n }\r\n if (item.valueStyle) {\r\n valStyles.push(item.valueStyle);\r\n }\r\n\r\n if (direction === \"horizontal\") {\r\n const rowStyles: Style[] = [styles.rowHorizontal];\r\n if (divided && !isLast) {\r\n const dividerStyle: Style = {};\r\n if (dividerColor) {\r\n dividerStyle.borderBottomColor = resolveColor(\r\n dividerColor,\r\n theme.colors\r\n );\r\n }\r\n if (dividerThickness) {\r\n dividerStyle.borderBottomWidth = dividerThickness;\r\n }\r\n if (dividerMargin) {\r\n dividerStyle.marginBottom = dividerMargin;\r\n }\r\n rowStyles.push({ ...styles.divider, ...dividerStyle });\r\n }\r\n return (\r\n <View key={item.key} style={rowStyles}>\r\n <PDFText style={[...keyStyles, { flex: labelFlex }]}>\r\n {item.key}\r\n </PDFText>\r\n <PDFText style={[...valStyles, { flex: 1, textAlign: \"right\" }]}>\r\n {item.value}\r\n </PDFText>\r\n </View>\r\n );\r\n }\r\n\r\n const rowStyles: Style[] = [styles.rowVertical];\r\n if (divided && !isLast) {\r\n rowStyles.push(styles.divider);\r\n }\r\n return (\r\n <View key={item.key} style={rowStyles}>\r\n <PDFText style={keyStyles}>{item.key}</PDFText>\r\n <PDFText style={valStyles}>{item.value}</PDFText>\r\n </View>\r\n );\r\n })}\r\n </View>\r\n );\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type KeyValueDirection = \"horizontal\" | \"vertical\";\nexport type KeyValueSize = \"sm\" | \"md\" | \"lg\";\n\n/**\n * A single key-value row with optional per-item color and style overrides.\n * Props - `key` | `value` | `valueColor` | `valueStyle` | `keyStyle`\n * @see {@link KeyValueEntry}\n */\nexport interface KeyValueEntry {\n key: string;\n value: string;\n valueColor?: string;\n valueStyle?: Style;\n keyStyle?: Style;\n}\n\n/**\n * List of key-value pairs with layout and style options.\n * Props - `items` | `direction` | `divided` | `size` | `labelFlex` | `labelColor` | `valueColor` | `boldValue` | `noWrap` | `dividerColor` | `dividerThickness` | `dividerMargin` | `style`\n * @see {@link KeyValueProps}\n */\nexport interface KeyValueProps extends Omit<PDFComponentProps, \"children\"> {\n items: KeyValueEntry[];\n /**\n * @default 'horizontal'\n */\n direction?: KeyValueDirection;\n /**\n * @default false\n */\n divided?: boolean;\n /**\n * @default 'md'\n */\n size?: KeyValueSize;\n /**\n * @default 1\n */\n labelFlex?: number;\n labelColor?: string;\n valueColor?: string;\n /**\n * @default false\n */\n boldValue?: boolean;\n /**\n * @default false\n */\n noWrap?: boolean;\n dividerColor?: string;\n dividerThickness?: number;\n dividerMargin?: number;\n}\n\nconst createKeyValueStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights } = t.primitives;\n const c = t.colors;\n const { body } = t.typography;\n const keyBase = {\n color: c.mutedForeground,\n fontFamily: body.fontFamily,\n fontWeight: fontWeights.medium,\n };\n const valueBase = {\n color: c.foreground,\n fontFamily: body.fontFamily,\n fontWeight: fontWeights.regular,\n };\n return StyleSheet.create({\n container: { flexDirection: \"column\" },\n divider: {\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n },\n keyLg: { ...keyBase, fontSize: t.primitives.typography.base },\n keyMd: { ...keyBase, fontSize: body.fontSize },\n keySm: { ...keyBase, fontSize: t.primitives.typography.xs },\n rowHorizontal: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n paddingVertical: spacing[1],\n },\n rowVertical: {\n flexDirection: \"column\",\n marginBottom: t.spacing.paragraphGap,\n },\n valueBold: { fontWeight: fontWeights.bold },\n valueLg: { ...valueBase, fontSize: t.primitives.typography.base },\n valueMd: { ...valueBase, fontSize: body.fontSize },\n valueSm: { ...valueBase, fontSize: t.primitives.typography.xs },\n });\n};\n\nexport const KeyValue = ({\n items,\n direction = \"horizontal\",\n divided = false,\n size = \"md\",\n labelFlex = 1,\n labelColor,\n valueColor,\n boldValue = false,\n noWrap = false,\n dividerColor,\n dividerThickness,\n dividerMargin,\n style,\n}: KeyValueProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createKeyValueStyles(theme), [theme]);\n const keyStyleMap = {\n lg: styles.keyLg,\n md: styles.keyMd,\n sm: styles.keySm,\n } as Record<KeyValueSize, Style>;\n const valueStyleMap = {\n lg: styles.valueLg,\n md: styles.valueMd,\n sm: styles.valueSm,\n } as Record<KeyValueSize, Style>;\n const containerStyles: Style[] = [styles.container];\n if (style) {\n containerStyles.push(...[style].flat());\n }\n\n return (\n <View wrap={!noWrap} style={containerStyles}>\n {items.map((item, index) => {\n const isLast = index === items.length - 1;\n const keyStyles: Style[] = [keyStyleMap[size]];\n if (labelColor) {\n keyStyles.push({ color: resolveColor(labelColor, theme.colors) });\n }\n if (item.keyStyle) {\n keyStyles.push(item.keyStyle);\n }\n const valStyles: Style[] = [valueStyleMap[size]];\n if (boldValue) {\n valStyles.push(styles.valueBold);\n }\n const resolvedValueColor = item.valueColor ?? valueColor;\n if (resolvedValueColor) {\n valStyles.push({\n color: resolveColor(resolvedValueColor, theme.colors),\n });\n }\n if (item.valueStyle) {\n valStyles.push(item.valueStyle);\n }\n\n if (direction === \"horizontal\") {\n const rowStyles: Style[] = [styles.rowHorizontal];\n if (divided && !isLast) {\n const dividerStyle: Style = {};\n if (dividerColor) {\n dividerStyle.borderBottomColor = resolveColor(\n dividerColor,\n theme.colors\n );\n }\n if (dividerThickness) {\n dividerStyle.borderBottomWidth = dividerThickness;\n }\n if (dividerMargin) {\n dividerStyle.marginBottom = dividerMargin;\n }\n rowStyles.push({ ...styles.divider, ...dividerStyle });\n }\n return (\n <View key={item.key} style={rowStyles}>\n <PDFText style={[...keyStyles, { flex: labelFlex }]}>\n {item.key}\n </PDFText>\n <PDFText style={[...valStyles, { flex: 1, textAlign: \"right\" }]}>\n {item.value}\n </PDFText>\n </View>\n );\n }\n\n const rowStyles: Style[] = [styles.rowVertical];\n if (divided && !isLast) {\n rowStyles.push(styles.divider);\n }\n return (\n <View key={item.key} style={rowStyles}>\n <PDFText style={keyStyles}>{item.key}</PDFText>\n <PDFText style={valStyles}>{item.value}</PDFText>\n </View>\n );\n })}\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/key-value/key-value.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/lesson-plan.json b/apps/web/public/r/takumi/lesson-plan.json
index 7110f4d..e157d73 100644
--- a/apps/web/public/r/takumi/lesson-plan.json
+++ b/apps/web/public/r/takumi/lesson-plan.json
@@ -18,7 +18,7 @@
"files": [
{
"path": "registry/bases/takumi/blocks/lesson-plan/lesson-plan.tsx",
- "content": "import { PageFooter } from \"@/registry/bases/takumi/components/page-footer/page-footer\";\nimport { PageHeader } from \"@/registry/bases/takumi/components/page-header/page-header\";\nimport { Section } from \"@/registry/bases/takumi/components/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/registry/bases/takumi/components/table/table\";\nimport { Text } from \"@/registry/bases/takumi/components/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n Document,\n Page,\n StyleSheet,\n View,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type { LessonPlanProps } from \"./lesson-plan.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: LessonPlanProps = {\n accentColor: \"#7c3aed\",\n assessment: {\n formative: [\"Exit ticket\", \"Observation during guided practice\"],\n summative: [\"Chapter quiz\"],\n },\n date: \"September 15, 2026\",\n differentiation: [\n \"Provide equation mats for visual learners\",\n \"Allow calculator use for students with processing difficulties\",\n \"Offer extension problems for advanced learners\",\n ],\n duration: \"50 minutes\",\n essentialQuestion:\n \"How can we represent real-world relationships using linear equations?\",\n gradeLevel: \"8th Grade\",\n homework: \"Complete worksheet problems 11-20\",\n lessonTitle: \"Introduction to Linear Equations\",\n materials: [\"Graph paper\", \"Rulers\", \"Calculator\", \"Whiteboard markers\"],\n objectives: [\n \"Define linear equations\",\n \"Graph linear equations on a coordinate plane\",\n \"Solve simple linear equations\",\n ],\n sequence: [\n {\n activity: \"Warm-up\",\n description: \"Review solving one-step equations\",\n notes: \"5 problems on the board\",\n time: \"5 min\",\n },\n {\n activity: \"Introduction\",\n description: \"Define linear equations, show examples\",\n notes: \"Use real-world context\",\n time: \"10 min\",\n },\n {\n activity: \"Guided Practice\",\n description: \"Work through 3 examples together\",\n notes: \"Check for understanding\",\n time: \"15 min\",\n },\n {\n activity: \"Independent Practice\",\n description: \"Complete worksheet problems 1-10\",\n notes: \"Circulate and support\",\n time: \"15 min\",\n },\n {\n activity: \"Closure\",\n description: \"Exit ticket: solve one linear equation\",\n notes: \"Collect before dismissal\",\n time: \"5 min\",\n },\n ],\n standards: [\"CCSS.MATH.8.EE.B.6\", \"CCSS.MATH.8.EE.C.7\"],\n subject: \"Mathematics\",\n teacherName: \"Ms. Johnson\",\n topic: \"Linear Equations\",\n};\n\nconst REFLECTION_LINE_KEYS = Array.from(\n { length: 8 },\n (_, line) => `reflection-line-${line}`\n);\n\nconst COLUMN_WIDTHS = { activity: 104, notes: 140, time: 56 };\n\nconst LessonPlanContent = ({ data }: { data: LessonPlanProps }) => {\n const theme = usePdfcnTheme();\n const rule = {\n borderBottomColor: theme.colors.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n };\n\n const styles = StyleSheet.create({\n block: {\n marginBottom: 16,\n },\n colHalf: {\n flex: 2,\n paddingRight: 20,\n },\n colQuarter: {\n flex: 1,\n paddingRight: 10,\n },\n infoRow: {\n ...rule,\n flexDirection: \"row\",\n marginBottom: 16,\n paddingBottom: 12,\n },\n intro: {\n marginBottom: 3,\n },\n label: {\n fontSize: 9,\n fontWeight: \"bold\",\n marginBottom: 4,\n },\n listMarker: {\n width: 12,\n },\n listRow: {\n flexDirection: \"row\",\n marginBottom: 3,\n },\n listText: {\n flex: 1,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n reflectionLine: {\n ...rule,\n height: 24,\n },\n row: {\n flexDirection: \"row\",\n },\n });\n\n const renderLabel = (label: string) => (\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n {label}\n </Text>\n );\n\n const renderList = (items: string[] = [], numbered = false) =>\n items.length > 0 ? (\n items.map((item, index) => (\n <View key={item} style={styles.listRow}>\n <View style={styles.listMarker}>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {numbered ? `${index + 1}.` : \"•\"}\n </Text>\n </View>\n <View style={styles.listText}>\n <Text variant=\"xs\" noMargin>\n {item}\n </Text>\n </View>\n </View>\n ))\n ) : (\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n —\n </Text>\n );\n\n const info = [\n { label: \"Subject\", value: data.subject },\n { label: \"Grade Level\", value: data.gradeLevel },\n { label: \"Teacher\", value: data.teacherName },\n { label: \"Duration\", value: data.duration },\n ];\n\n const footerText = `${data.subject} · ${data.gradeLevel} · ${data.lessonTitle}`;\n\n return (\n <Document title={`Lesson Plan — ${data.lessonTitle}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"simple\"\n title={data.lessonTitle}\n subtitle={data.topic ? `Lesson Plan · ${data.topic}` : \"Lesson Plan\"}\n rightText={data.date}\n marginBottom={16}\n />\n\n <View style={styles.infoRow}>\n {info.map((item) => (\n <View key={item.label} style={styles.colQuarter}>\n {renderLabel(item.label)}\n <Text variant=\"xs\" weight=\"medium\" noMargin>\n {item.value}\n </Text>\n </View>\n ))}\n </View>\n\n {data.essentialQuestion ? (\n <Section\n variant=\"highlight\"\n accentColor={data.accentColor}\n spacing=\"none\"\n padding=\"sm\"\n style={styles.block}\n >\n {renderLabel(\"Essential Question\")}\n <Text variant=\"sm\" weight=\"medium\" noMargin>\n {data.essentialQuestion}\n </Text>\n </Section>\n ) : null}\n\n <View style={{ ...styles.row, ...styles.block }}>\n <View style={styles.colHalf}>\n {renderLabel(\"Objectives\")}\n <Text\n variant=\"xs\"\n color=\"mutedForeground\"\n style={styles.intro}\n noMargin\n >\n Students will be able to (SWBAT):\n </Text>\n {renderList(data.objectives, true)}\n </View>\n {data.standards?.length ? (\n <View style={styles.colQuarter}>\n {renderLabel(\"Standards\")}\n {renderList(data.standards)}\n </View>\n ) : null}\n <View style={styles.colQuarter}>\n {renderLabel(\"Materials\")}\n {renderList(data.materials)}\n </View>\n </View>\n\n <View>\n {renderLabel(\"Lesson Sequence\")}\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell width={COLUMN_WIDTHS.time}>Time</TableCell>\n <TableCell width={COLUMN_WIDTHS.activity}>Activity</TableCell>\n <TableCell>Description</TableCell>\n <TableCell width={COLUMN_WIDTHS.notes}>Notes</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.sequence.map((item) => (\n <TableRow key={`${item.time}-${item.activity}`}>\n <TableCell width={COLUMN_WIDTHS.time}>{item.time}</TableCell>\n <TableCell width={COLUMN_WIDTHS.activity}>\n {item.activity}\n </TableCell>\n <TableCell>{item.description}</TableCell>\n <TableCell width={COLUMN_WIDTHS.notes}>\n {item.notes ?? \"—\"}\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </View>\n\n <PageFooter\n leftText={footerText}\n rightText=\"Page 1 of 2\"\n sticky\n pagePadding={25}\n />\n </Page>\n\n <Page size=\"A4\" style={styles.page}>\n {data.differentiation?.length ? (\n <View style={styles.block}>\n {renderLabel(\"Differentiation\")}\n {renderList(data.differentiation)}\n </View>\n ) : null}\n\n <View style={{ ...styles.row, ...styles.block }}>\n <View style={styles.colHalf}>\n {renderLabel(\"Formative Assessment\")}\n {renderList(data.assessment.formative)}\n </View>\n <View style={styles.colHalf}>\n {renderLabel(\"Summative Assessment\")}\n {renderList(data.assessment.summative)}\n </View>\n </View>\n\n {data.homework ? (\n <View style={styles.block}>\n {renderLabel(\"Homework\")}\n <Text variant=\"xs\" noMargin>\n {data.homework}\n </Text>\n </View>\n ) : null}\n\n <View>\n {renderLabel(\"Teacher Reflection\")}\n {data.reflection ? (\n <Text variant=\"xs\" noMargin>\n {data.reflection}\n </Text>\n ) : null}\n {REFLECTION_LINE_KEYS.map((key) => (\n <View key={key} style={styles.reflectionLine} />\n ))}\n </View>\n\n <PageFooter\n leftText={footerText}\n rightText=\"Page 2 of 2\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const LessonPlanDocument = ({\n theme,\n data,\n ...props\n}: {\n theme?: PdfcnTheme;\n data?: LessonPlanProps;\n} & Partial<LessonPlanProps>) => (\n <PdfcnThemeProvider theme={theme}>\n <LessonPlanContent data={{ ...sampleData, ...data, ...props }} />\n </PdfcnThemeProvider>\n);\n",
+ "content": "import { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Document,\n Page,\n StyleSheet,\n View,\n} from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { LessonPlanProps } from \"./lesson-plan.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: LessonPlanProps = {\n accentColor: \"#7c3aed\",\n assessment: {\n formative: [\"Exit ticket\", \"Observation during guided practice\"],\n summative: [\"Chapter quiz\"],\n },\n date: \"September 15, 2026\",\n differentiation: [\n \"Provide equation mats for visual learners\",\n \"Allow calculator use for students with processing difficulties\",\n \"Offer extension problems for advanced learners\",\n ],\n duration: \"50 minutes\",\n essentialQuestion:\n \"How can we represent real-world relationships using linear equations?\",\n gradeLevel: \"8th Grade\",\n homework: \"Complete worksheet problems 11-20\",\n lessonTitle: \"Introduction to Linear Equations\",\n materials: [\"Graph paper\", \"Rulers\", \"Calculator\", \"Whiteboard markers\"],\n objectives: [\n \"Define linear equations\",\n \"Graph linear equations on a coordinate plane\",\n \"Solve simple linear equations\",\n ],\n sequence: [\n {\n activity: \"Warm-up\",\n description: \"Review solving one-step equations\",\n notes: \"5 problems on the board\",\n time: \"5 min\",\n },\n {\n activity: \"Introduction\",\n description: \"Define linear equations, show examples\",\n notes: \"Use real-world context\",\n time: \"10 min\",\n },\n {\n activity: \"Guided Practice\",\n description: \"Work through 3 examples together\",\n notes: \"Check for understanding\",\n time: \"15 min\",\n },\n {\n activity: \"Independent Practice\",\n description: \"Complete worksheet problems 1-10\",\n notes: \"Circulate and support\",\n time: \"15 min\",\n },\n {\n activity: \"Closure\",\n description: \"Exit ticket: solve one linear equation\",\n notes: \"Collect before dismissal\",\n time: \"5 min\",\n },\n ],\n standards: [\"CCSS.MATH.8.EE.B.6\", \"CCSS.MATH.8.EE.C.7\"],\n subject: \"Mathematics\",\n teacherName: \"Ms. Johnson\",\n topic: \"Linear Equations\",\n};\n\nconst REFLECTION_LINE_KEYS = Array.from(\n { length: 8 },\n (_, line) => `reflection-line-${line}`\n);\n\nconst COLUMN_WIDTHS = { activity: 104, notes: 140, time: 56 };\n\nconst LessonPlanContent = ({ data }: { data: LessonPlanProps }) => {\n const theme = usePdfcnTheme();\n const rule = {\n borderBottomColor: theme.colors.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n };\n\n const styles = StyleSheet.create({\n block: {\n marginBottom: 16,\n },\n colHalf: {\n flex: 2,\n paddingRight: 20,\n },\n colQuarter: {\n flex: 1,\n paddingRight: 10,\n },\n infoRow: {\n ...rule,\n flexDirection: \"row\",\n marginBottom: 16,\n paddingBottom: 12,\n },\n intro: {\n marginBottom: 3,\n },\n label: {\n fontSize: 9,\n fontWeight: \"bold\",\n marginBottom: 4,\n },\n listMarker: {\n width: 12,\n },\n listRow: {\n flexDirection: \"row\",\n marginBottom: 3,\n },\n listText: {\n flex: 1,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n reflectionLine: {\n ...rule,\n height: 24,\n },\n row: {\n flexDirection: \"row\",\n },\n });\n\n const renderLabel = (label: string) => (\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n {label}\n </Text>\n );\n\n const renderList = (items: string[] = [], numbered = false) =>\n items.length > 0 ? (\n items.map((item, index) => (\n <View key={item} style={styles.listRow}>\n <View style={styles.listMarker}>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {numbered ? `${index + 1}.` : \"•\"}\n </Text>\n </View>\n <View style={styles.listText}>\n <Text variant=\"xs\" noMargin>\n {item}\n </Text>\n </View>\n </View>\n ))\n ) : (\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n —\n </Text>\n );\n\n const info = [\n { label: \"Subject\", value: data.subject },\n { label: \"Grade Level\", value: data.gradeLevel },\n { label: \"Teacher\", value: data.teacherName },\n { label: \"Duration\", value: data.duration },\n ];\n\n const footerText = `${data.subject} · ${data.gradeLevel} · ${data.lessonTitle}`;\n\n return (\n <Document title={`Lesson Plan — ${data.lessonTitle}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"simple\"\n title={data.lessonTitle}\n subtitle={data.topic ? `Lesson Plan · ${data.topic}` : \"Lesson Plan\"}\n rightText={data.date}\n marginBottom={16}\n />\n\n <View style={styles.infoRow}>\n {info.map((item) => (\n <View key={item.label} style={styles.colQuarter}>\n {renderLabel(item.label)}\n <Text variant=\"xs\" weight=\"medium\" noMargin>\n {item.value}\n </Text>\n </View>\n ))}\n </View>\n\n {data.essentialQuestion ? (\n <Section\n variant=\"highlight\"\n accentColor={data.accentColor}\n spacing=\"none\"\n padding=\"sm\"\n style={styles.block}\n >\n {renderLabel(\"Essential Question\")}\n <Text variant=\"sm\" weight=\"medium\" noMargin>\n {data.essentialQuestion}\n </Text>\n </Section>\n ) : null}\n\n <View style={{ ...styles.row, ...styles.block }}>\n <View style={styles.colHalf}>\n {renderLabel(\"Objectives\")}\n <Text\n variant=\"xs\"\n color=\"mutedForeground\"\n style={styles.intro}\n noMargin\n >\n Students will be able to (SWBAT):\n </Text>\n {renderList(data.objectives, true)}\n </View>\n {data.standards?.length ? (\n <View style={styles.colQuarter}>\n {renderLabel(\"Standards\")}\n {renderList(data.standards)}\n </View>\n ) : null}\n <View style={styles.colQuarter}>\n {renderLabel(\"Materials\")}\n {renderList(data.materials)}\n </View>\n </View>\n\n <View>\n {renderLabel(\"Lesson Sequence\")}\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell width={COLUMN_WIDTHS.time}>Time</TableCell>\n <TableCell width={COLUMN_WIDTHS.activity}>Activity</TableCell>\n <TableCell>Description</TableCell>\n <TableCell width={COLUMN_WIDTHS.notes}>Notes</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.sequence.map((item) => (\n <TableRow key={`${item.time}-${item.activity}`}>\n <TableCell width={COLUMN_WIDTHS.time}>{item.time}</TableCell>\n <TableCell width={COLUMN_WIDTHS.activity}>\n {item.activity}\n </TableCell>\n <TableCell>{item.description}</TableCell>\n <TableCell width={COLUMN_WIDTHS.notes}>\n {item.notes ?? \"—\"}\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </View>\n\n <PageFooter\n leftText={footerText}\n rightText=\"Page 1 of 2\"\n sticky\n pagePadding={25}\n />\n </Page>\n\n <Page size=\"A4\" style={styles.page}>\n {data.differentiation?.length ? (\n <View style={styles.block}>\n {renderLabel(\"Differentiation\")}\n {renderList(data.differentiation)}\n </View>\n ) : null}\n\n <View style={{ ...styles.row, ...styles.block }}>\n <View style={styles.colHalf}>\n {renderLabel(\"Formative Assessment\")}\n {renderList(data.assessment.formative)}\n </View>\n <View style={styles.colHalf}>\n {renderLabel(\"Summative Assessment\")}\n {renderList(data.assessment.summative)}\n </View>\n </View>\n\n {data.homework ? (\n <View style={styles.block}>\n {renderLabel(\"Homework\")}\n <Text variant=\"xs\" noMargin>\n {data.homework}\n </Text>\n </View>\n ) : null}\n\n <View>\n {renderLabel(\"Teacher Reflection\")}\n {data.reflection ? (\n <Text variant=\"xs\" noMargin>\n {data.reflection}\n </Text>\n ) : null}\n {REFLECTION_LINE_KEYS.map((key) => (\n <View key={key} style={styles.reflectionLine} />\n ))}\n </View>\n\n <PageFooter\n leftText={footerText}\n rightText=\"Page 2 of 2\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const LessonPlanDocument = ({\n theme,\n data,\n ...props\n}: {\n theme?: PdfcnTheme;\n data?: LessonPlanProps;\n} & Partial<LessonPlanProps>) => (\n <PdfcnThemeProvider theme={theme}>\n <LessonPlanContent data={{ ...sampleData, ...data, ...props }} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/lesson-plan/lesson-plan.tsx"
},
@@ -30,4 +30,4 @@
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/link.json b/apps/web/public/r/takumi/link.json
index 875d977..d284451 100644
--- a/apps/web/public/r/takumi/link.json
+++ b/apps/web/public/r/takumi/link.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/takumi/components/link/link.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n StyleSheet,\r\n Link as PDFLink,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type LinkVariant = \"default\" | \"muted\" | \"primary\";\r\nexport type LinkUnderline = \"always\" | \"none\";\r\n\r\n/**\r\n * Clickable hyperlink for PDF documents.\r\n * Props - `href` | `children` | `align` | `color` | `variant` | `underline` | `style`\r\n * @see {@link LinkProps}\r\n */\r\nexport interface LinkProps extends PDFComponentProps {\r\n href: string;\r\n /**\r\n * @default 'left'\r\n */\r\n align?: \"left\" | \"center\" | \"right\";\r\n color?: string;\r\n /**\r\n * @default 'default'\r\n */\r\n variant?: LinkVariant;\r\n /**\r\n * @default 'always'\r\n */\r\n underline?: LinkUnderline;\r\n}\r\n\r\nconst createLinkStyles = (t: PdfcnTheme) => {\r\n const { fontWeights } = t.primitives;\r\n const base = {\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n lineHeight: t.typography.body.lineHeight,\r\n marginBottom: t.spacing.paragraphGap,\r\n };\r\n return StyleSheet.create({\r\n default: {\r\n ...base,\r\n color: t.colors.accent,\r\n fontWeight: fontWeights.medium,\r\n textDecoration: \"underline\",\r\n },\r\n muted: {\r\n ...base,\r\n color: t.colors.mutedForeground,\r\n fontWeight: fontWeights.regular,\r\n textDecoration: \"underline\",\r\n },\r\n primary: {\r\n ...base,\r\n color: t.colors.primary,\r\n fontWeight: fontWeights.semibold,\r\n textDecoration: \"underline\",\r\n },\r\n underlineAlways: { textDecoration: \"underline\" },\r\n underlineNone: { textDecoration: \"none\" },\r\n });\r\n};\r\n\r\nexport const Link = ({\r\n href,\r\n align,\r\n color,\r\n variant = \"default\",\r\n underline,\r\n children,\r\n style,\r\n}: LinkProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createLinkStyles(theme), [theme]);\r\n const variantMap = {\r\n default: styles.default,\r\n muted: styles.muted,\r\n primary: styles.primary,\r\n };\r\n const underlineMap = {\r\n always: styles.underlineAlways,\r\n none: styles.underlineNone,\r\n };\r\n const styleArray: Style[] = [variantMap[variant]];\r\n if (underline && underline in underlineMap) {\r\n styleArray.push(underlineMap[underline]);\r\n }\r\n const semantic = {} as Style;\r\n if (align) {\r\n semantic.textAlign = align;\r\n }\r\n if (color) {\r\n semantic.color = resolveColor(color, theme.colors);\r\n }\r\n if (Object.keys(semantic).length > 0) {\r\n styleArray.push(semantic);\r\n }\r\n if (style) {\r\n styleArray.push(...[style].flat());\r\n }\r\n return (\r\n <PDFLink src={href} style={styleArray}>\r\n {children}\r\n </PDFLink>\r\n );\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n StyleSheet,\n Link as PDFLink,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type LinkVariant = \"default\" | \"muted\" | \"primary\";\nexport type LinkUnderline = \"always\" | \"none\";\n\n/**\n * Clickable hyperlink for PDF documents.\n * Props - `href` | `children` | `align` | `color` | `variant` | `underline` | `style`\n * @see {@link LinkProps}\n */\nexport interface LinkProps extends PDFComponentProps {\n href: string;\n /**\n * @default 'left'\n */\n align?: \"left\" | \"center\" | \"right\";\n color?: string;\n /**\n * @default 'default'\n */\n variant?: LinkVariant;\n /**\n * @default 'always'\n */\n underline?: LinkUnderline;\n}\n\nconst createLinkStyles = (t: PdfcnTheme) => {\n const { fontWeights } = t.primitives;\n const base = {\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n lineHeight: t.typography.body.lineHeight,\n marginBottom: t.spacing.paragraphGap,\n };\n return StyleSheet.create({\n default: {\n ...base,\n color: t.colors.accent,\n fontWeight: fontWeights.medium,\n textDecoration: \"underline\",\n },\n muted: {\n ...base,\n color: t.colors.mutedForeground,\n fontWeight: fontWeights.regular,\n textDecoration: \"underline\",\n },\n primary: {\n ...base,\n color: t.colors.primary,\n fontWeight: fontWeights.semibold,\n textDecoration: \"underline\",\n },\n underlineAlways: { textDecoration: \"underline\" },\n underlineNone: { textDecoration: \"none\" },\n });\n};\n\nexport const Link = ({\n href,\n align,\n color,\n variant = \"default\",\n underline,\n children,\n style,\n}: LinkProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createLinkStyles(theme), [theme]);\n const variantMap = {\n default: styles.default,\n muted: styles.muted,\n primary: styles.primary,\n };\n const underlineMap = {\n always: styles.underlineAlways,\n none: styles.underlineNone,\n };\n const styleArray: Style[] = [variantMap[variant]];\n if (underline && underline in underlineMap) {\n styleArray.push(underlineMap[underline]);\n }\n const semantic = {} as Style;\n if (align) {\n semantic.textAlign = align;\n }\n if (color) {\n semantic.color = resolveColor(color, theme.colors);\n }\n if (Object.keys(semantic).length > 0) {\n styleArray.push(semantic);\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return (\n <PDFLink src={href} style={styleArray}>\n {children}\n </PDFLink>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/link/link.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/list.json b/apps/web/public/r/takumi/list.json
index 234648f..4bb4120 100644
--- a/apps/web/public/r/takumi/list.json
+++ b/apps/web/public/r/takumi/list.json
@@ -13,22 +13,22 @@
"files": [
{
"path": "registry/bases/takumi/components/list/list.styles.ts",
- "content": "import { StyleSheet } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\n/**\r\n * Creates all list styles derived from the active theme.\r\n * @param t - The resolved PdfcnTheme instance.\r\n */\r\nexport const createListStyles = (t: PdfcnTheme) => {\r\n const { borderRadius, spacing, fontWeights, typography } = t.primitives;\r\n\r\n return StyleSheet.create({\r\n checkBox: {\r\n alignItems: \"center\",\r\n backgroundColor: t.colors.background,\r\n borderColor: t.colors.border,\r\n borderRadius: 3,\r\n borderStyle: \"solid\",\r\n borderWidth: 1.5,\r\n height: spacing[4],\r\n justifyContent: \"center\",\r\n marginRight: spacing[2],\r\n width: spacing[4],\r\n },\r\n checkBoxChecked: {\r\n backgroundColor: t.colors.success,\r\n borderColor: t.colors.success,\r\n },\r\n childrenContainer: {\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n marginLeft: spacing[5],\r\n marginTop: spacing[1],\r\n },\r\n container: {\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n marginBottom: t.spacing.componentGap,\r\n width: \"100%\",\r\n },\r\n descriptiveAccent: {\r\n backgroundColor: t.colors.primary,\r\n borderRadius: borderRadius.sm,\r\n marginRight: spacing[3],\r\n minHeight: spacing[4],\r\n width: 3,\r\n },\r\n descriptiveContent: {\r\n flex: 1,\r\n },\r\n descriptiveDesc: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.sm,\r\n lineHeight: t.typography.body.lineHeight,\r\n marginTop: 1,\r\n },\r\n descriptiveTitle: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n fontWeight: fontWeights.semibold,\r\n lineHeight: t.typography.body.lineHeight,\r\n },\r\n iconBox: {\r\n alignItems: \"center\",\r\n backgroundColor: t.colors.primary,\r\n borderRadius: borderRadius.md,\r\n height: spacing[5],\r\n justifyContent: \"center\",\r\n marginRight: spacing[2],\r\n width: spacing[5],\r\n },\r\n iconMark: {\r\n color: t.colors.primaryForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: 9,\r\n fontWeight: fontWeights.bold,\r\n },\r\n itemRow: {\r\n alignItems: \"flex-start\",\r\n flexDirection: \"row\",\r\n },\r\n itemRowCenter: {\r\n alignItems: \"center\",\r\n flexDirection: \"row\",\r\n },\r\n itemRowGapMd: { marginBottom: spacing[3] },\r\n itemRowGapSm: { marginBottom: spacing[2] },\r\n itemRowGapXs: { marginBottom: spacing[1] },\r\n itemText: {\r\n // No flex here — Text nodes with flex shorthand get flexBasis:0, which causes\r\n // Yoga to under-measure multi-line text height → overlapping rows.\r\n // flex:1 must live on the wrapping View, not on the Text itself.\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n lineHeight: t.typography.body.lineHeight,\r\n },\r\n itemTextBold: {\r\n fontWeight: fontWeights.semibold,\r\n },\r\n itemTextSub: {\r\n // Same: no flex — see itemText comment.\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize - 0.5,\r\n lineHeight: t.typography.body.lineHeight,\r\n },\r\n itemTextWrap: {\r\n // Companion to itemText / itemTextSub. Apply this to the View that wraps\r\n // the Text so flex expansion happens at the View level, not the Text level.\r\n flex: 1,\r\n },\r\n markerBulletDot: {\r\n backgroundColor: t.colors.primary,\r\n borderRadius: 3,\r\n height: 5,\r\n width: 5,\r\n },\r\n markerBulletSubDot: {\r\n backgroundColor: \"transparent\",\r\n borderColor: t.colors.mutedForeground,\r\n borderRadius: 2,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n height: 4,\r\n width: 4,\r\n },\r\n markerBulletSubWrap: {\r\n alignItems: \"center\",\r\n justifyContent: \"flex-start\",\r\n marginTop: spacing[1],\r\n width: spacing[4],\r\n },\r\n markerBulletWrap: {\r\n alignItems: \"center\",\r\n justifyContent: \"flex-start\",\r\n marginTop: spacing[1],\r\n width: spacing[4],\r\n },\r\n markerNumberBadge: {\r\n alignItems: \"center\",\r\n backgroundColor: t.colors.primary,\r\n borderRadius: spacing[5],\r\n height: spacing[5],\r\n justifyContent: \"center\",\r\n marginRight: spacing[2],\r\n width: spacing[5],\r\n },\r\n markerNumberText: {\r\n color: t.colors.primaryForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.xs,\r\n fontWeight: fontWeights.bold,\r\n },\r\n });\r\n};\r\n",
+ "content": "import { StyleSheet } from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\n/**\n * Creates all list styles derived from the active theme.\n * @param t - The resolved PdfcnTheme instance.\n */\nexport const createListStyles = (t: PdfcnTheme) => {\n const { borderRadius, spacing, fontWeights, typography } = t.primitives;\n\n return StyleSheet.create({\n checkBox: {\n alignItems: \"center\",\n backgroundColor: t.colors.background,\n borderColor: t.colors.border,\n borderRadius: 3,\n borderStyle: \"solid\",\n borderWidth: 1.5,\n height: spacing[4],\n justifyContent: \"center\",\n marginRight: spacing[2],\n width: spacing[4],\n },\n checkBoxChecked: {\n backgroundColor: t.colors.success,\n borderColor: t.colors.success,\n },\n childrenContainer: {\n display: \"flex\",\n flexDirection: \"column\",\n marginLeft: spacing[5],\n marginTop: spacing[1],\n },\n container: {\n display: \"flex\",\n flexDirection: \"column\",\n marginBottom: t.spacing.componentGap,\n width: \"100%\",\n },\n descriptiveAccent: {\n backgroundColor: t.colors.primary,\n borderRadius: borderRadius.sm,\n marginRight: spacing[3],\n minHeight: spacing[4],\n width: 3,\n },\n descriptiveContent: {\n flex: 1,\n },\n descriptiveDesc: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n lineHeight: t.typography.body.lineHeight,\n marginTop: 1,\n },\n descriptiveTitle: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: t.typography.body.lineHeight,\n },\n iconBox: {\n alignItems: \"center\",\n backgroundColor: t.colors.primary,\n borderRadius: borderRadius.md,\n height: spacing[5],\n justifyContent: \"center\",\n marginRight: spacing[2],\n width: spacing[5],\n },\n iconMark: {\n color: t.colors.primaryForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: 9,\n fontWeight: fontWeights.bold,\n },\n itemRow: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n },\n itemRowCenter: {\n alignItems: \"center\",\n flexDirection: \"row\",\n },\n itemRowGapMd: { marginBottom: spacing[3] },\n itemRowGapSm: { marginBottom: spacing[2] },\n itemRowGapXs: { marginBottom: spacing[1] },\n itemText: {\n // No flex here — Text nodes with flex shorthand get flexBasis:0, which causes\n // Yoga to under-measure multi-line text height → overlapping rows.\n // flex:1 must live on the wrapping View, not on the Text itself.\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n lineHeight: t.typography.body.lineHeight,\n },\n itemTextBold: {\n fontWeight: fontWeights.semibold,\n },\n itemTextSub: {\n // Same: no flex — see itemText comment.\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize - 0.5,\n lineHeight: t.typography.body.lineHeight,\n },\n itemTextWrap: {\n // Companion to itemText / itemTextSub. Apply this to the View that wraps\n // the Text so flex expansion happens at the View level, not the Text level.\n flex: 1,\n },\n markerBulletDot: {\n backgroundColor: t.colors.primary,\n borderRadius: 3,\n height: 5,\n width: 5,\n },\n markerBulletSubDot: {\n backgroundColor: \"transparent\",\n borderColor: t.colors.mutedForeground,\n borderRadius: 2,\n borderStyle: \"solid\",\n borderWidth: 1,\n height: 4,\n width: 4,\n },\n markerBulletSubWrap: {\n alignItems: \"center\",\n justifyContent: \"flex-start\",\n marginTop: spacing[1],\n width: spacing[4],\n },\n markerBulletWrap: {\n alignItems: \"center\",\n justifyContent: \"flex-start\",\n marginTop: spacing[1],\n width: spacing[4],\n },\n markerNumberBadge: {\n alignItems: \"center\",\n backgroundColor: t.colors.primary,\n borderRadius: spacing[5],\n height: spacing[5],\n justifyContent: \"center\",\n marginRight: spacing[2],\n width: spacing[5],\n },\n markerNumberText: {\n color: t.colors.primaryForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.bold,\n },\n });\n};\n",
"type": "registry:component",
"target": "components/pdf/list/list.styles.ts"
},
{
"path": "registry/bases/takumi/components/list/list.tsx",
- "content": "import type React from \"react\";\r\n\r\nimport {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n Text as PDFText,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\n\r\nimport { createListStyles } from \"./list.styles\";\r\nimport type { ListItem, ListVariant, PdfListProps } from \"./list.types\";\r\n\r\ntype Styles = ReturnType<typeof createListStyles>;\r\ntype GapProp = \"xs\" | \"sm\" | \"md\";\r\n\r\nconst getGapStyle = (gap: GapProp, styles: Styles): Style => {\r\n if (gap === \"xs\") {\r\n return styles.itemRowGapXs;\r\n }\r\n if (gap === \"md\") {\r\n return styles.itemRowGapMd;\r\n }\r\n return styles.itemRowGapSm;\r\n};\r\n\r\nconst buildRowStyles = (\r\n index: number,\r\n total: number,\r\n gap: GapProp,\r\n styles: Styles,\r\n align: \"start\" | \"center\" = \"start\"\r\n): Style[] => {\r\n const row: Style[] = [\r\n align === \"center\" ? styles.itemRowCenter : styles.itemRow,\r\n ];\r\n if (index !== total - 1) {\r\n row.push(getGapStyle(gap, styles));\r\n }\r\n return row;\r\n};\r\n\r\n/** Bullet dot marker — solid filled for level 0, outline ring for nested levels. */\r\nconst dotMarker = (level: number, styles: Styles): React.ReactElement =>\r\n level === 0 ? (\r\n <View style={styles.markerBulletWrap}>\r\n <View style={styles.markerBulletDot} />\r\n </View>\r\n ) : (\r\n <View style={styles.markerBulletSubWrap}>\r\n <View style={styles.markerBulletSubDot} />\r\n </View>\r\n );\r\n\r\n// eslint-disable-next-line no-use-before-define, prefer-const\r\nlet renderBulletItem: (\r\n item: ListItem,\r\n index: number,\r\n total: number,\r\n gap: GapProp,\r\n styles: Styles,\r\n level: number\r\n) => React.ReactElement;\r\n// eslint-disable-next-line no-use-before-define, prefer-const\r\nlet renderMultiLevelItem: (\r\n item: ListItem,\r\n index: number,\r\n total: number,\r\n gap: GapProp,\r\n styles: Styles,\r\n level: number\r\n) => React.ReactElement;\r\n\r\nconst renderNumberedItem = (\r\n item: ListItem,\r\n index: number,\r\n total: number,\r\n gap: GapProp,\r\n styles: Styles\r\n): React.ReactElement => (\r\n <View key={index} style={buildRowStyles(index, total, gap, styles, \"center\")}>\r\n <View style={styles.markerNumberBadge}>\r\n <PDFText style={styles.markerNumberText}>{`${index + 1}`}</PDFText>\r\n </View>\r\n <View style={styles.itemTextWrap}>\r\n <PDFText style={styles.itemText}>{item.text}</PDFText>\r\n </View>\r\n </View>\r\n);\r\n\r\nconst renderChecklistItem = (\r\n item: ListItem,\r\n index: number,\r\n total: number,\r\n gap: GapProp,\r\n styles: Styles\r\n): React.ReactElement => {\r\n const isChecked = item.checked ?? true;\r\n return (\r\n <View\r\n key={index}\r\n style={buildRowStyles(index, total, gap, styles, \"center\")}\r\n >\r\n <View\r\n style={[styles.checkBox, isChecked ? styles.checkBoxChecked : {}]}\r\n ></View>\r\n <View style={styles.itemTextWrap}>\r\n <PDFText style={styles.itemText}>{item.text}</PDFText>\r\n </View>\r\n </View>\r\n );\r\n};\r\n\r\nconst renderIconItem = (\r\n item: ListItem,\r\n index: number,\r\n total: number,\r\n gap: GapProp,\r\n styles: Styles\r\n): React.ReactElement => (\r\n <View key={index} style={buildRowStyles(index, total, gap, styles, \"center\")}>\r\n <View style={styles.iconBox}>\r\n <PDFText style={styles.iconMark}>★</PDFText>\r\n </View>\r\n <View style={styles.itemTextWrap}>\r\n <PDFText style={styles.itemText}>{item.text}</PDFText>\r\n </View>\r\n </View>\r\n);\r\n\r\nconst renderDescriptiveItem = (\r\n item: ListItem,\r\n index: number,\r\n total: number,\r\n gap: GapProp,\r\n styles: Styles\r\n): React.ReactElement => (\r\n <View key={index} style={buildRowStyles(index, total, gap, styles)}>\r\n <View style={styles.descriptiveAccent} />\r\n <View style={styles.descriptiveContent}>\r\n <PDFText style={styles.descriptiveTitle}>{item.text}</PDFText>\r\n {item.description ? (\r\n <PDFText style={styles.descriptiveDesc}>{item.description}</PDFText>\r\n ) : null}\r\n </View>\r\n </View>\r\n);\r\n\r\nconst renderItem = (\r\n item: ListItem,\r\n index: number,\r\n total: number,\r\n variant: ListVariant,\r\n gap: GapProp,\r\n styles: Styles,\r\n level: number\r\n): React.ReactElement | null => {\r\n switch (variant) {\r\n case \"bullet\": {\r\n return renderBulletItem(item, index, total, gap, styles, level);\r\n }\r\n case \"numbered\": {\r\n return renderNumberedItem(item, index, total, gap, styles);\r\n }\r\n case \"checklist\": {\r\n return renderChecklistItem(item, index, total, gap, styles);\r\n }\r\n case \"icon\": {\r\n return renderIconItem(item, index, total, gap, styles);\r\n }\r\n case \"multi-level\": {\r\n return renderMultiLevelItem(item, index, total, gap, styles, level);\r\n }\r\n case \"descriptive\": {\r\n return renderDescriptiveItem(item, index, total, gap, styles);\r\n }\r\n default: {\r\n break;\r\n }\r\n }\r\n return null;\r\n};\r\n\r\nconst renderItemList = (\r\n items: ListItem[],\r\n variant: ListVariant,\r\n gap: GapProp,\r\n styles: Styles,\r\n level: number\r\n): React.ReactElement => (\r\n <View style={level > 0 ? styles.childrenContainer : undefined}>\r\n {items.map((item, index) =>\r\n renderItem(item, index, items.length, variant, gap, styles, level)\r\n )}\r\n </View>\r\n);\r\n\r\nrenderBulletItem = (item, index, total, gap, styles, level) => (\r\n <View key={index}>\r\n <View style={buildRowStyles(index, total, gap, styles)}>\r\n {dotMarker(level, styles)}\r\n <View style={styles.itemTextWrap}>\r\n <PDFText style={styles.itemText}>{item.text}</PDFText>\r\n </View>\r\n </View>\r\n {item.children && item.children.length > 0\r\n ? renderItemList(item.children, \"bullet\", gap, styles, level + 1)\r\n : null}\r\n </View>\r\n);\r\n\r\nrenderMultiLevelItem = (item, index, total, gap, styles, level) => (\r\n <View key={index}>\r\n <View style={buildRowStyles(index, total, gap, styles)}>\r\n {dotMarker(level, styles)}\r\n <View style={styles.itemTextWrap}>\r\n <PDFText\r\n style={[\r\n level === 0 ? styles.itemText : styles.itemTextSub,\r\n level === 0 ? styles.itemTextBold : {},\r\n ]}\r\n >\r\n {item.text}\r\n </PDFText>\r\n </View>\r\n </View>\r\n {item.children && item.children.length > 0\r\n ? renderItemList(item.children, \"multi-level\", gap, styles, level + 1)\r\n : null}\r\n </View>\r\n);\r\n\r\nexport const PdfList = ({\r\n items,\r\n variant = \"bullet\",\r\n gap = \"sm\",\r\n style,\r\n noWrap = false,\r\n _level = 0,\r\n}: PdfListProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createListStyles(theme), [theme]);\r\n\r\n const containerStyles: Style[] = [styles.container];\r\n if (_level > 0) {\r\n containerStyles.push(styles.childrenContainer);\r\n }\r\n const styleArray = style ? [...containerStyles, style] : containerStyles;\r\n\r\n return (\r\n <View wrap={!noWrap} style={styleArray}>\r\n {items.map((item, index) =>\r\n renderItem(item, index, items.length, variant, gap, styles, _level)\r\n )}\r\n </View>\r\n );\r\n};\r\n",
+ "content": "import type React from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n Text as PDFText,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\n\nimport { createListStyles } from \"./list.styles\";\nimport type { ListItem, ListVariant, PdfListProps } from \"./list.types\";\n\ntype Styles = ReturnType<typeof createListStyles>;\ntype GapProp = \"xs\" | \"sm\" | \"md\";\n\nconst getGapStyle = (gap: GapProp, styles: Styles): Style => {\n if (gap === \"xs\") {\n return styles.itemRowGapXs;\n }\n if (gap === \"md\") {\n return styles.itemRowGapMd;\n }\n return styles.itemRowGapSm;\n};\n\nconst buildRowStyles = (\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles,\n align: \"start\" | \"center\" = \"start\"\n): Style[] => {\n const row: Style[] = [\n align === \"center\" ? styles.itemRowCenter : styles.itemRow,\n ];\n if (index !== total - 1) {\n row.push(getGapStyle(gap, styles));\n }\n return row;\n};\n\n/** Bullet dot marker — solid filled for level 0, outline ring for nested levels. */\nconst dotMarker = (level: number, styles: Styles): React.ReactElement =>\n level === 0 ? (\n <View style={styles.markerBulletWrap}>\n <View style={styles.markerBulletDot} />\n </View>\n ) : (\n <View style={styles.markerBulletSubWrap}>\n <View style={styles.markerBulletSubDot} />\n </View>\n );\n\n// eslint-disable-next-line no-use-before-define, prefer-const\nlet renderBulletItem: (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles,\n level: number\n) => React.ReactElement;\n// eslint-disable-next-line no-use-before-define, prefer-const\nlet renderMultiLevelItem: (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles,\n level: number\n) => React.ReactElement;\n\nconst renderNumberedItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => (\n <View key={index} style={buildRowStyles(index, total, gap, styles, \"center\")}>\n <View style={styles.markerNumberBadge}>\n <PDFText style={styles.markerNumberText}>{`${index + 1}`}</PDFText>\n </View>\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n);\n\nconst renderChecklistItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => {\n const isChecked = item.checked ?? true;\n return (\n <View\n key={index}\n style={buildRowStyles(index, total, gap, styles, \"center\")}\n >\n <View\n style={[styles.checkBox, isChecked ? styles.checkBoxChecked : {}]}\n ></View>\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n );\n};\n\nconst renderIconItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => (\n <View key={index} style={buildRowStyles(index, total, gap, styles, \"center\")}>\n <View style={styles.iconBox}>\n <PDFText style={styles.iconMark}>★</PDFText>\n </View>\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n);\n\nconst renderDescriptiveItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => (\n <View key={index} style={buildRowStyles(index, total, gap, styles)}>\n <View style={styles.descriptiveAccent} />\n <View style={styles.descriptiveContent}>\n <PDFText style={styles.descriptiveTitle}>{item.text}</PDFText>\n {item.description ? (\n <PDFText style={styles.descriptiveDesc}>{item.description}</PDFText>\n ) : null}\n </View>\n </View>\n);\n\nconst renderItem = (\n item: ListItem,\n index: number,\n total: number,\n variant: ListVariant,\n gap: GapProp,\n styles: Styles,\n level: number\n): React.ReactElement | null => {\n switch (variant) {\n case \"bullet\": {\n return renderBulletItem(item, index, total, gap, styles, level);\n }\n case \"numbered\": {\n return renderNumberedItem(item, index, total, gap, styles);\n }\n case \"checklist\": {\n return renderChecklistItem(item, index, total, gap, styles);\n }\n case \"icon\": {\n return renderIconItem(item, index, total, gap, styles);\n }\n case \"multi-level\": {\n return renderMultiLevelItem(item, index, total, gap, styles, level);\n }\n case \"descriptive\": {\n return renderDescriptiveItem(item, index, total, gap, styles);\n }\n default: {\n break;\n }\n }\n return null;\n};\n\nconst renderItemList = (\n items: ListItem[],\n variant: ListVariant,\n gap: GapProp,\n styles: Styles,\n level: number\n): React.ReactElement => (\n <View style={level > 0 ? styles.childrenContainer : undefined}>\n {items.map((item, index) =>\n renderItem(item, index, items.length, variant, gap, styles, level)\n )}\n </View>\n);\n\nrenderBulletItem = (item, index, total, gap, styles, level) => (\n <View key={index}>\n <View style={buildRowStyles(index, total, gap, styles)}>\n {dotMarker(level, styles)}\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n {item.children && item.children.length > 0\n ? renderItemList(item.children, \"bullet\", gap, styles, level + 1)\n : null}\n </View>\n);\n\nrenderMultiLevelItem = (item, index, total, gap, styles, level) => (\n <View key={index}>\n <View style={buildRowStyles(index, total, gap, styles)}>\n {dotMarker(level, styles)}\n <View style={styles.itemTextWrap}>\n <PDFText\n style={[\n level === 0 ? styles.itemText : styles.itemTextSub,\n level === 0 ? styles.itemTextBold : {},\n ]}\n >\n {item.text}\n </PDFText>\n </View>\n </View>\n {item.children && item.children.length > 0\n ? renderItemList(item.children, \"multi-level\", gap, styles, level + 1)\n : null}\n </View>\n);\n\nexport const PdfList = ({\n items,\n variant = \"bullet\",\n gap = \"sm\",\n style,\n noWrap = false,\n _level = 0,\n}: PdfListProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createListStyles(theme), [theme]);\n\n const containerStyles: Style[] = [styles.container];\n if (_level > 0) {\n containerStyles.push(styles.childrenContainer);\n }\n const styleArray = style ? [...containerStyles, style] : containerStyles;\n\n return (\n <View wrap={!noWrap} style={styleArray}>\n {items.map((item, index) =>\n renderItem(item, index, items.length, variant, gap, styles, _level)\n )}\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/list/list.tsx"
},
{
"path": "registry/bases/takumi/components/list/list.types.ts",
- "content": "import type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\n\r\n/** List visual style variant. */\r\nexport type ListVariant =\r\n | \"bullet\"\r\n | \"numbered\"\r\n | \"checklist\"\r\n | \"icon\"\r\n | \"multi-level\"\r\n | \"descriptive\";\r\n\r\n/**\r\n * A single list item, optionally with nested children.\r\n * Props - `text` | `description` | `checked` | `children`\r\n * @see {@link ListItem}\r\n */\r\nexport interface ListItem {\r\n text: string;\r\n description?: string;\r\n checked?: boolean;\r\n children?: ListItem[];\r\n}\r\n\r\n/**\r\n * List of items with multiple style variants including bullet, numbered, checklist, and descriptive.\r\n * Props - `items` | `variant` | `gap` | `style` | `_level` | `noWrap`\r\n * @see {@link PdfListProps}\r\n */\r\nexport interface PdfListProps {\r\n items: ListItem[];\r\n /**\r\n * @default 'bullet'\r\n */\r\n variant?: ListVariant;\r\n /**\r\n * @default 'sm'\r\n */\r\n gap?: \"xs\" | \"sm\" | \"md\";\r\n style?: Style;\r\n _level?: number;\r\n /**\r\n * @default false\r\n */\r\n noWrap?: boolean;\r\n}\r\n",
+ "content": "import type { Style } from \"@/lib/pdf-primitives\";\n\n/** List visual style variant. */\nexport type ListVariant =\n | \"bullet\"\n | \"numbered\"\n | \"checklist\"\n | \"icon\"\n | \"multi-level\"\n | \"descriptive\";\n\n/**\n * A single list item, optionally with nested children.\n * Props - `text` | `description` | `checked` | `children`\n * @see {@link ListItem}\n */\nexport interface ListItem {\n text: string;\n description?: string;\n checked?: boolean;\n children?: ListItem[];\n}\n\n/**\n * List of items with multiple style variants including bullet, numbered, checklist, and descriptive.\n * Props - `items` | `variant` | `gap` | `style` | `_level` | `noWrap`\n * @see {@link PdfListProps}\n */\nexport interface PdfListProps {\n items: ListItem[];\n /**\n * @default 'bullet'\n */\n variant?: ListVariant;\n /**\n * @default 'sm'\n */\n gap?: \"xs\" | \"sm\" | \"md\";\n style?: Style;\n _level?: number;\n /**\n * @default false\n */\n noWrap?: boolean;\n}\n",
"type": "registry:component",
"target": "components/pdf/list/list.types.ts"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/medical-intake-form.json b/apps/web/public/r/takumi/medical-intake-form.json
index d79f705..3dbbc19 100644
--- a/apps/web/public/r/takumi/medical-intake-form.json
+++ b/apps/web/public/r/takumi/medical-intake-form.json
@@ -22,16 +22,16 @@
"files": [
{
"path": "registry/bases/takumi/blocks/medical-intake-form/medical-intake-form.tsx",
- "content": "import { PdfForm } from \"@/registry/bases/takumi/components/form/form\";\nimport { PdfList } from \"@/registry/bases/takumi/components/list/list\";\nimport { PageFooter } from \"@/registry/bases/takumi/components/page-footer/page-footer\";\nimport { PageHeader } from \"@/registry/bases/takumi/components/page-header/page-header\";\nimport { PdfImage } from \"@/registry/bases/takumi/components/pdf-image/pdf-image\";\nimport { Section } from \"@/registry/bases/takumi/components/section/section\";\nimport { PdfSignatureBlock } from \"@/registry/bases/takumi/components/signature/signature\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/registry/bases/takumi/components/table/table\";\nimport { Text } from \"@/registry/bases/takumi/components/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type { MedicalIntakeFormProps } from \"./medical-intake-form.types\";\n\nconst FORM_VERSION = \"Form v1.0 · Revised 09/2026\";\nconst FORM_STYLE = { marginBottom: 0 };\n\nconst MEDICAL_CONDITIONS = [\n \"Diabetes\",\n \"High Blood Pressure\",\n \"Heart Disease\",\n \"Asthma\",\n \"COPD\",\n \"Cancer\",\n \"Stroke\",\n \"Thyroid Disorder\",\n \"Kidney Disease\",\n \"Liver Disease\",\n \"Seizures / Epilepsy\",\n \"Other\",\n];\n\nconst CONSENT_ACKNOWLEDGMENTS = [\n { checked: false, text: \"I have read and understand the consent above.\" },\n { checked: false, text: \"I have received the Notice of Privacy Practices.\" },\n];\n\nconst MEDICATION_ROWS = [\n \"medication-1\",\n \"medication-2\",\n \"medication-3\",\n \"medication-4\",\n];\n\nconst ALLERGY_ROWS = [\"allergy-1\", \"allergy-2\", \"allergy-3\"];\n\nconst BLANK_CELL = <View style={{ minHeight: 14 }} />;\n\nconst blankChecklist = (labels: string[]) =>\n labels.map((text) => ({ checked: false, text }));\n\nconst createIntakeStyles = (t: PdfcnTheme) =>\n StyleSheet.create({\n column: { flex: 1 },\n consentText: {\n fontSize: t.primitives.typography.xs,\n lineHeight: 1.4,\n marginBottom: 6,\n },\n labelText: { fontSize: 9, fontWeight: \"bold\", letterSpacing: 0.6 },\n page: {\n backgroundColor: t.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n paddingBottom: t.spacing.page.marginBottom,\n paddingLeft: t.spacing.page.marginLeft,\n paddingRight: t.spacing.page.marginRight,\n paddingTop: t.spacing.page.marginTop,\n position: \"relative\",\n },\n pageBreak: { breakAfter: \"page\" },\n pageTwo: { paddingBottom: 44, paddingTop: 24 },\n pageTwoHeader: {\n alignItems: \"flex-end\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n },\n reasonBox: {\n borderColor: t.colors.border,\n borderRadius: t.primitives.borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: 1,\n minHeight: 40,\n },\n row: { flexDirection: \"row\", gap: 20 },\n section: { marginBottom: 4 },\n signature: { marginBottom: 0, marginTop: 8 },\n title: { fontSize: 13, fontWeight: \"bold\" },\n });\n\ntype IntakeStyles = ReturnType<typeof createIntakeStyles>;\n\nconst useIntakeStyles = (): { styles: IntakeStyles; theme: PdfcnTheme } => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createIntakeStyles(theme), [theme]);\n return { styles, theme };\n};\n\nconst SectionLabel = ({ accent, label }: { accent: string; label: string }) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View\n style={{\n borderBottomColor: accent,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n marginBottom: 4,\n paddingBottom: 2,\n }}\n >\n <Text noMargin style={styles.labelText} transform=\"uppercase\">\n {label}\n </Text>\n </View>\n );\n};\n\nconst IntakeHeader = ({\n clinicAddress,\n clinicLogo,\n clinicName,\n clinicPhone,\n}: Pick<\n MedicalIntakeFormProps,\n \"clinicAddress\" | \"clinicLogo\" | \"clinicName\" | \"clinicPhone\"\n>) => (\n <PageHeader\n logo={\n clinicLogo ? (\n <PdfImage\n height={48}\n src={clinicLogo}\n style={{ margin: 0 }}\n width={48}\n />\n ) : undefined\n }\n marginBottom={16}\n rightSubText={clinicAddress}\n rightText={clinicPhone}\n subtitle=\"Patient Intake Form\"\n title={clinicName}\n variant=\"logo-left\"\n />\n);\n\nconst SecondPageHeader = ({\n clinicName,\n clinicPhone,\n}: Pick<MedicalIntakeFormProps, \"clinicName\" | \"clinicPhone\">) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.pageTwoHeader}>\n <Text noMargin style={styles.title}>\n {`${clinicName} — Patient Intake Form (continued)`}\n </Text>\n <Text color=\"mutedForeground\" noMargin variant=\"xs\">\n {clinicPhone}\n </Text>\n </View>\n );\n};\n\nconst IntakeFooter = ({\n clinicAddress,\n clinicPhone,\n page,\n totalPages,\n}: Pick<MedicalIntakeFormProps, \"clinicAddress\" | \"clinicPhone\"> & {\n page: number;\n totalPages: number;\n}) => {\n const { theme } = useIntakeStyles();\n\n return (\n <PageFooter\n address={clinicAddress}\n leftText={FORM_VERSION}\n pagePadding={theme.spacing.page.marginLeft}\n phone={clinicPhone}\n rightText={`Page ${page} of ${totalPages}`}\n sticky\n variant=\"three-column\"\n />\n );\n};\n\nconst PersonalInfoSection = () => (\n <PdfForm\n groups={[\n {\n fields: [\n { height: 14, label: \"Full Name\" },\n { height: 14, hint: \"DD / MM / YYYY\", label: \"Date of Birth\" },\n { height: 14, label: \"Gender\" },\n { height: 14, hint: \"+1 (555) 000-0000\", label: \"Phone Number\" },\n { height: 14, label: \"Email Address\" },\n ],\n layout: \"two-column\",\n title: \"Patient Information\",\n },\n {\n fields: [\n { height: 14, label: \"Street Address\", width: \"100%\" },\n { height: 14, label: \"City\" },\n { height: 14, label: \"State / Province\" },\n { height: 14, label: \"Postal Code\" },\n ],\n layout: \"two-column\",\n title: \"Address\",\n },\n ]}\n style={FORM_STYLE}\n variant=\"underline\"\n />\n);\n\nconst EmergencyContactSection = () => (\n <PdfForm\n groups={[\n {\n fields: [\n { height: 14, label: \"Emergency Contact Name\" },\n { height: 14, label: \"Relationship\" },\n { height: 14, label: \"Phone Number\" },\n ],\n layout: \"two-column\",\n title: \"Emergency Contact\",\n },\n ]}\n style={FORM_STYLE}\n variant=\"underline\"\n />\n);\n\nconst InsuranceSection = () => (\n <PdfForm\n groups={[\n {\n fields: [\n { height: 14, label: \"Insurance Provider\" },\n { height: 14, label: \"Policy Number\" },\n { height: 14, label: \"Group Number\" },\n { height: 14, label: \"Subscriber Name\" },\n ],\n layout: \"two-column\",\n title: \"Insurance\",\n },\n ]}\n style={FORM_STYLE}\n variant=\"underline\"\n />\n);\n\nconst MedicalHistorySection = ({ accent }: { accent: string }) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.section}>\n <SectionLabel accent={accent} label=\"Medical History\" />\n <View style={styles.row}>\n <View style={styles.column}>\n <PdfList\n gap=\"xs\"\n items={blankChecklist(MEDICAL_CONDITIONS.slice(0, 4))}\n variant=\"checklist\"\n />\n </View>\n <View style={styles.column}>\n <PdfList\n gap=\"xs\"\n items={blankChecklist(MEDICAL_CONDITIONS.slice(4, 8))}\n variant=\"checklist\"\n />\n </View>\n <View style={styles.column}>\n <PdfList\n gap=\"xs\"\n items={blankChecklist(MEDICAL_CONDITIONS.slice(8))}\n variant=\"checklist\"\n />\n </View>\n </View>\n </View>\n );\n};\n\nconst MedicationsSection = ({ accent }: { accent: string }) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.section}>\n <SectionLabel accent={accent} label=\"Current Medications\" />\n <Table variant=\"grid\">\n <TableHeader>\n <TableRow header>\n <TableCell>Medication</TableCell>\n <TableCell>Dosage</TableCell>\n <TableCell>Frequency</TableCell>\n <TableCell>Prescribing Doctor</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {MEDICATION_ROWS.map((row) => (\n <TableRow key={row}>\n <TableCell>{BLANK_CELL}</TableCell>\n <TableCell>{BLANK_CELL}</TableCell>\n <TableCell>{BLANK_CELL}</TableCell>\n <TableCell>{BLANK_CELL}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </View>\n );\n};\n\nconst AllergiesSection = ({ accent }: { accent: string }) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.section}>\n <SectionLabel accent={accent} label=\"Allergies\" />\n <Table variant=\"grid\">\n <TableHeader>\n <TableRow header>\n <TableCell>Allergen</TableCell>\n <TableCell>Reaction</TableCell>\n <TableCell>Severity</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {ALLERGY_ROWS.map((row) => (\n <TableRow key={row}>\n <TableCell>{BLANK_CELL}</TableCell>\n <TableCell>{BLANK_CELL}</TableCell>\n <TableCell>{BLANK_CELL}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </View>\n );\n};\n\nconst ReasonForVisitSection = ({ accent }: { accent: string }) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.section}>\n <SectionLabel accent={accent} label=\"Reason for Visit\" />\n <View style={styles.reasonBox} />\n </View>\n );\n};\n\nconst ConsentSection = ({\n accent,\n accentColor,\n clinicName,\n}: Pick<MedicalIntakeFormProps, \"accentColor\" | \"clinicName\"> & {\n accent: string;\n}) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.section}>\n <SectionLabel accent={accent} label=\"Consent & Authorization\" />\n <Section\n accentColor={accentColor}\n padding=\"sm\"\n spacing=\"none\"\n variant=\"highlight\"\n >\n <Text color=\"mutedForeground\" noMargin style={styles.consentText}>\n {`I authorize ${clinicName} to provide treatment and to release the information required to process insurance claims for this visit, and I acknowledge that I have received the Notice of Privacy Practices (HIPAA) explaining how my health information may be used.`}\n </Text>\n <PdfList gap=\"xs\" items={CONSENT_ACKNOWLEDGMENTS} variant=\"checklist\" />\n </Section>\n <PdfSignatureBlock\n signers={[{ label: \"Patient / Guardian Signature\" }, { label: \"Date\" }]}\n style={styles.signature}\n variant=\"double\"\n />\n </View>\n );\n};\n\ntype IntakeSections = Required<\n Pick<\n MedicalIntakeFormProps,\n | \"allergies\"\n | \"consent\"\n | \"emergencyContact\"\n | \"insurance\"\n | \"medicalHistory\"\n | \"medications\"\n | \"personalInfo\"\n | \"reasonForVisit\"\n >\n>;\n\nconst resolveSections = (props: MedicalIntakeFormProps): IntakeSections => ({\n allergies: props.allergies ?? true,\n consent: props.consent ?? true,\n emergencyContact: props.emergencyContact ?? true,\n insurance: props.insurance ?? true,\n medicalHistory: props.medicalHistory ?? true,\n medications: props.medications ?? true,\n personalInfo: props.personalInfo ?? true,\n reasonForVisit: props.reasonForVisit ?? true,\n});\n\nconst hasSecondPage = (sections: IntakeSections) =>\n sections.allergies ||\n sections.consent ||\n sections.medications ||\n sections.reasonForVisit;\n\nconst FirstPage = ({\n clinicAddress,\n clinicLogo,\n clinicName,\n clinicPhone,\n sections,\n totalPages,\n}: Pick<\n MedicalIntakeFormProps,\n \"clinicAddress\" | \"clinicLogo\" | \"clinicName\" | \"clinicPhone\"\n> & {\n sections: IntakeSections;\n totalPages: number;\n}) => {\n const { styles } = useIntakeStyles();\n\n return (\n <Page\n size=\"A4\"\n style={totalPages > 1 ? [styles.page, styles.pageBreak] : styles.page}\n >\n <IntakeHeader\n clinicAddress={clinicAddress}\n clinicLogo={clinicLogo}\n clinicName={clinicName}\n clinicPhone={clinicPhone}\n />\n {sections.personalInfo ? <PersonalInfoSection /> : null}\n {sections.emergencyContact ? <EmergencyContactSection /> : null}\n {sections.insurance ? <InsuranceSection /> : null}\n <IntakeFooter\n clinicAddress={clinicAddress}\n clinicPhone={clinicPhone}\n page={1}\n totalPages={totalPages}\n />\n </Page>\n );\n};\n\nconst SecondPage = ({\n accent,\n accentColor,\n clinicAddress,\n clinicName,\n clinicPhone,\n sections,\n totalPages,\n}: Pick<\n MedicalIntakeFormProps,\n \"accentColor\" | \"clinicAddress\" | \"clinicName\" | \"clinicPhone\"\n> & {\n accent: string;\n sections: IntakeSections;\n totalPages: number;\n}) => {\n const { styles } = useIntakeStyles();\n\n return (\n <Page size=\"A4\" style={[styles.page, styles.pageTwo]}>\n <SecondPageHeader clinicName={clinicName} clinicPhone={clinicPhone} />\n {sections.medicalHistory ? (\n <MedicalHistorySection accent={accent} />\n ) : null}\n {sections.medications ? <MedicationsSection accent={accent} /> : null}\n {sections.allergies ? <AllergiesSection accent={accent} /> : null}\n {sections.reasonForVisit ? (\n <ReasonForVisitSection accent={accent} />\n ) : null}\n {sections.consent ? (\n <ConsentSection\n accent={accent}\n accentColor={accentColor}\n clinicName={clinicName}\n />\n ) : null}\n <IntakeFooter\n clinicAddress={clinicAddress}\n clinicPhone={clinicPhone}\n page={2}\n totalPages={totalPages}\n />\n </Page>\n );\n};\n\nconst MedicalIntakeFormContent = (props: MedicalIntakeFormProps) => {\n const { theme } = useIntakeStyles();\n const sections = resolveSections(props);\n const accent = props.accentColor\n ? resolveColor(props.accentColor, theme.colors)\n : theme.colors.primary;\n const totalPages = hasSecondPage(sections) ? 2 : 1;\n\n return (\n <Document title={`${props.clinicName} — Patient Intake Form`}>\n <FirstPage\n clinicAddress={props.clinicAddress}\n clinicLogo={props.clinicLogo}\n clinicName={props.clinicName}\n clinicPhone={props.clinicPhone}\n sections={sections}\n totalPages={totalPages}\n />\n {totalPages > 1 ? (\n <SecondPage\n accent={accent}\n accentColor={props.accentColor}\n clinicAddress={props.clinicAddress}\n clinicName={props.clinicName}\n clinicPhone={props.clinicPhone}\n sections={sections}\n totalPages={totalPages}\n />\n ) : null}\n </Document>\n );\n};\n\n/**\n * Print-ready medical intake form with patient, emergency contact, insurance,\n * medical history, medication, allergy, reason for visit, and consent\n * sections. Every section can be hidden through its boolean prop, and all\n * fields are left blank for the patient to complete by hand.\n */\nexport const MedicalIntakeFormDocument = ({\n theme,\n ...props\n}: MedicalIntakeFormProps) => (\n <PdfcnThemeProvider theme={theme}>\n <MedicalIntakeFormContent {...props} />\n </PdfcnThemeProvider>\n);\n",
+ "content": "import { PdfForm } from \"@/components/pdf/form/form\";\nimport { PdfList } from \"@/components/pdf/list/list\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { PdfImage } from \"@/components/pdf/pdf-image/pdf-image\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport { PdfSignatureBlock } from \"@/components/pdf/signature/signature\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { MedicalIntakeFormProps } from \"./medical-intake-form.types\";\n\nconst FORM_VERSION = \"Form v1.0 · Revised 09/2026\";\nconst FORM_STYLE = { marginBottom: 0 };\n\nconst MEDICAL_CONDITIONS = [\n \"Diabetes\",\n \"High Blood Pressure\",\n \"Heart Disease\",\n \"Asthma\",\n \"COPD\",\n \"Cancer\",\n \"Stroke\",\n \"Thyroid Disorder\",\n \"Kidney Disease\",\n \"Liver Disease\",\n \"Seizures / Epilepsy\",\n \"Other\",\n];\n\nconst CONSENT_ACKNOWLEDGMENTS = [\n { checked: false, text: \"I have read and understand the consent above.\" },\n { checked: false, text: \"I have received the Notice of Privacy Practices.\" },\n];\n\nconst MEDICATION_ROWS = [\n \"medication-1\",\n \"medication-2\",\n \"medication-3\",\n \"medication-4\",\n];\n\nconst ALLERGY_ROWS = [\"allergy-1\", \"allergy-2\", \"allergy-3\"];\n\nconst BLANK_CELL = <View style={{ minHeight: 14 }} />;\n\nconst blankChecklist = (labels: string[]) =>\n labels.map((text) => ({ checked: false, text }));\n\nconst createIntakeStyles = (t: PdfcnTheme) =>\n StyleSheet.create({\n column: { flex: 1 },\n consentText: {\n fontSize: t.primitives.typography.xs,\n lineHeight: 1.4,\n marginBottom: 6,\n },\n labelText: { fontSize: 9, fontWeight: \"bold\", letterSpacing: 0.6 },\n page: {\n backgroundColor: t.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n paddingBottom: t.spacing.page.marginBottom,\n paddingLeft: t.spacing.page.marginLeft,\n paddingRight: t.spacing.page.marginRight,\n paddingTop: t.spacing.page.marginTop,\n position: \"relative\",\n },\n pageBreak: { breakAfter: \"page\" },\n pageTwo: { paddingBottom: 44, paddingTop: 24 },\n pageTwoHeader: {\n alignItems: \"flex-end\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n },\n reasonBox: {\n borderColor: t.colors.border,\n borderRadius: t.primitives.borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: 1,\n minHeight: 40,\n },\n row: { flexDirection: \"row\", gap: 20 },\n section: { marginBottom: 4 },\n signature: { marginBottom: 0, marginTop: 8 },\n title: { fontSize: 13, fontWeight: \"bold\" },\n });\n\ntype IntakeStyles = ReturnType<typeof createIntakeStyles>;\n\nconst useIntakeStyles = (): { styles: IntakeStyles; theme: PdfcnTheme } => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createIntakeStyles(theme), [theme]);\n return { styles, theme };\n};\n\nconst SectionLabel = ({ accent, label }: { accent: string; label: string }) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View\n style={{\n borderBottomColor: accent,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n marginBottom: 4,\n paddingBottom: 2,\n }}\n >\n <Text noMargin style={styles.labelText} transform=\"uppercase\">\n {label}\n </Text>\n </View>\n );\n};\n\nconst IntakeHeader = ({\n clinicAddress,\n clinicLogo,\n clinicName,\n clinicPhone,\n}: Pick<\n MedicalIntakeFormProps,\n \"clinicAddress\" | \"clinicLogo\" | \"clinicName\" | \"clinicPhone\"\n>) => (\n <PageHeader\n logo={\n clinicLogo ? (\n <PdfImage\n height={48}\n src={clinicLogo}\n style={{ margin: 0 }}\n width={48}\n />\n ) : undefined\n }\n marginBottom={16}\n rightSubText={clinicAddress}\n rightText={clinicPhone}\n subtitle=\"Patient Intake Form\"\n title={clinicName}\n variant=\"logo-left\"\n />\n);\n\nconst SecondPageHeader = ({\n clinicName,\n clinicPhone,\n}: Pick<MedicalIntakeFormProps, \"clinicName\" | \"clinicPhone\">) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.pageTwoHeader}>\n <Text noMargin style={styles.title}>\n {`${clinicName} — Patient Intake Form (continued)`}\n </Text>\n <Text color=\"mutedForeground\" noMargin variant=\"xs\">\n {clinicPhone}\n </Text>\n </View>\n );\n};\n\nconst IntakeFooter = ({\n clinicAddress,\n clinicPhone,\n page,\n totalPages,\n}: Pick<MedicalIntakeFormProps, \"clinicAddress\" | \"clinicPhone\"> & {\n page: number;\n totalPages: number;\n}) => {\n const { theme } = useIntakeStyles();\n\n return (\n <PageFooter\n address={clinicAddress}\n leftText={FORM_VERSION}\n pagePadding={theme.spacing.page.marginLeft}\n phone={clinicPhone}\n rightText={`Page ${page} of ${totalPages}`}\n sticky\n variant=\"three-column\"\n />\n );\n};\n\nconst PersonalInfoSection = () => (\n <PdfForm\n groups={[\n {\n fields: [\n { height: 14, label: \"Full Name\" },\n { height: 14, hint: \"DD / MM / YYYY\", label: \"Date of Birth\" },\n { height: 14, label: \"Gender\" },\n { height: 14, hint: \"+1 (555) 000-0000\", label: \"Phone Number\" },\n { height: 14, label: \"Email Address\" },\n ],\n layout: \"two-column\",\n title: \"Patient Information\",\n },\n {\n fields: [\n { height: 14, label: \"Street Address\", width: \"100%\" },\n { height: 14, label: \"City\" },\n { height: 14, label: \"State / Province\" },\n { height: 14, label: \"Postal Code\" },\n ],\n layout: \"two-column\",\n title: \"Address\",\n },\n ]}\n style={FORM_STYLE}\n variant=\"underline\"\n />\n);\n\nconst EmergencyContactSection = () => (\n <PdfForm\n groups={[\n {\n fields: [\n { height: 14, label: \"Emergency Contact Name\" },\n { height: 14, label: \"Relationship\" },\n { height: 14, label: \"Phone Number\" },\n ],\n layout: \"two-column\",\n title: \"Emergency Contact\",\n },\n ]}\n style={FORM_STYLE}\n variant=\"underline\"\n />\n);\n\nconst InsuranceSection = () => (\n <PdfForm\n groups={[\n {\n fields: [\n { height: 14, label: \"Insurance Provider\" },\n { height: 14, label: \"Policy Number\" },\n { height: 14, label: \"Group Number\" },\n { height: 14, label: \"Subscriber Name\" },\n ],\n layout: \"two-column\",\n title: \"Insurance\",\n },\n ]}\n style={FORM_STYLE}\n variant=\"underline\"\n />\n);\n\nconst MedicalHistorySection = ({ accent }: { accent: string }) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.section}>\n <SectionLabel accent={accent} label=\"Medical History\" />\n <View style={styles.row}>\n <View style={styles.column}>\n <PdfList\n gap=\"xs\"\n items={blankChecklist(MEDICAL_CONDITIONS.slice(0, 4))}\n variant=\"checklist\"\n />\n </View>\n <View style={styles.column}>\n <PdfList\n gap=\"xs\"\n items={blankChecklist(MEDICAL_CONDITIONS.slice(4, 8))}\n variant=\"checklist\"\n />\n </View>\n <View style={styles.column}>\n <PdfList\n gap=\"xs\"\n items={blankChecklist(MEDICAL_CONDITIONS.slice(8))}\n variant=\"checklist\"\n />\n </View>\n </View>\n </View>\n );\n};\n\nconst MedicationsSection = ({ accent }: { accent: string }) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.section}>\n <SectionLabel accent={accent} label=\"Current Medications\" />\n <Table variant=\"grid\">\n <TableHeader>\n <TableRow header>\n <TableCell>Medication</TableCell>\n <TableCell>Dosage</TableCell>\n <TableCell>Frequency</TableCell>\n <TableCell>Prescribing Doctor</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {MEDICATION_ROWS.map((row) => (\n <TableRow key={row}>\n <TableCell>{BLANK_CELL}</TableCell>\n <TableCell>{BLANK_CELL}</TableCell>\n <TableCell>{BLANK_CELL}</TableCell>\n <TableCell>{BLANK_CELL}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </View>\n );\n};\n\nconst AllergiesSection = ({ accent }: { accent: string }) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.section}>\n <SectionLabel accent={accent} label=\"Allergies\" />\n <Table variant=\"grid\">\n <TableHeader>\n <TableRow header>\n <TableCell>Allergen</TableCell>\n <TableCell>Reaction</TableCell>\n <TableCell>Severity</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {ALLERGY_ROWS.map((row) => (\n <TableRow key={row}>\n <TableCell>{BLANK_CELL}</TableCell>\n <TableCell>{BLANK_CELL}</TableCell>\n <TableCell>{BLANK_CELL}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </View>\n );\n};\n\nconst ReasonForVisitSection = ({ accent }: { accent: string }) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.section}>\n <SectionLabel accent={accent} label=\"Reason for Visit\" />\n <View style={styles.reasonBox} />\n </View>\n );\n};\n\nconst ConsentSection = ({\n accent,\n accentColor,\n clinicName,\n}: Pick<MedicalIntakeFormProps, \"accentColor\" | \"clinicName\"> & {\n accent: string;\n}) => {\n const { styles } = useIntakeStyles();\n\n return (\n <View style={styles.section}>\n <SectionLabel accent={accent} label=\"Consent & Authorization\" />\n <Section\n accentColor={accentColor}\n padding=\"sm\"\n spacing=\"none\"\n variant=\"highlight\"\n >\n <Text color=\"mutedForeground\" noMargin style={styles.consentText}>\n {`I authorize ${clinicName} to provide treatment and to release the information required to process insurance claims for this visit, and I acknowledge that I have received the Notice of Privacy Practices (HIPAA) explaining how my health information may be used.`}\n </Text>\n <PdfList gap=\"xs\" items={CONSENT_ACKNOWLEDGMENTS} variant=\"checklist\" />\n </Section>\n <PdfSignatureBlock\n signers={[{ label: \"Patient / Guardian Signature\" }, { label: \"Date\" }]}\n style={styles.signature}\n variant=\"double\"\n />\n </View>\n );\n};\n\ntype IntakeSections = Required<\n Pick<\n MedicalIntakeFormProps,\n | \"allergies\"\n | \"consent\"\n | \"emergencyContact\"\n | \"insurance\"\n | \"medicalHistory\"\n | \"medications\"\n | \"personalInfo\"\n | \"reasonForVisit\"\n >\n>;\n\nconst resolveSections = (props: MedicalIntakeFormProps): IntakeSections => ({\n allergies: props.allergies ?? true,\n consent: props.consent ?? true,\n emergencyContact: props.emergencyContact ?? true,\n insurance: props.insurance ?? true,\n medicalHistory: props.medicalHistory ?? true,\n medications: props.medications ?? true,\n personalInfo: props.personalInfo ?? true,\n reasonForVisit: props.reasonForVisit ?? true,\n});\n\nconst hasSecondPage = (sections: IntakeSections) =>\n sections.allergies ||\n sections.consent ||\n sections.medications ||\n sections.reasonForVisit;\n\nconst FirstPage = ({\n clinicAddress,\n clinicLogo,\n clinicName,\n clinicPhone,\n sections,\n totalPages,\n}: Pick<\n MedicalIntakeFormProps,\n \"clinicAddress\" | \"clinicLogo\" | \"clinicName\" | \"clinicPhone\"\n> & {\n sections: IntakeSections;\n totalPages: number;\n}) => {\n const { styles } = useIntakeStyles();\n\n return (\n <Page\n size=\"A4\"\n style={totalPages > 1 ? [styles.page, styles.pageBreak] : styles.page}\n >\n <IntakeHeader\n clinicAddress={clinicAddress}\n clinicLogo={clinicLogo}\n clinicName={clinicName}\n clinicPhone={clinicPhone}\n />\n {sections.personalInfo ? <PersonalInfoSection /> : null}\n {sections.emergencyContact ? <EmergencyContactSection /> : null}\n {sections.insurance ? <InsuranceSection /> : null}\n <IntakeFooter\n clinicAddress={clinicAddress}\n clinicPhone={clinicPhone}\n page={1}\n totalPages={totalPages}\n />\n </Page>\n );\n};\n\nconst SecondPage = ({\n accent,\n accentColor,\n clinicAddress,\n clinicName,\n clinicPhone,\n sections,\n totalPages,\n}: Pick<\n MedicalIntakeFormProps,\n \"accentColor\" | \"clinicAddress\" | \"clinicName\" | \"clinicPhone\"\n> & {\n accent: string;\n sections: IntakeSections;\n totalPages: number;\n}) => {\n const { styles } = useIntakeStyles();\n\n return (\n <Page size=\"A4\" style={[styles.page, styles.pageTwo]}>\n <SecondPageHeader clinicName={clinicName} clinicPhone={clinicPhone} />\n {sections.medicalHistory ? (\n <MedicalHistorySection accent={accent} />\n ) : null}\n {sections.medications ? <MedicationsSection accent={accent} /> : null}\n {sections.allergies ? <AllergiesSection accent={accent} /> : null}\n {sections.reasonForVisit ? (\n <ReasonForVisitSection accent={accent} />\n ) : null}\n {sections.consent ? (\n <ConsentSection\n accent={accent}\n accentColor={accentColor}\n clinicName={clinicName}\n />\n ) : null}\n <IntakeFooter\n clinicAddress={clinicAddress}\n clinicPhone={clinicPhone}\n page={2}\n totalPages={totalPages}\n />\n </Page>\n );\n};\n\nconst MedicalIntakeFormContent = (props: MedicalIntakeFormProps) => {\n const { theme } = useIntakeStyles();\n const sections = resolveSections(props);\n const accent = props.accentColor\n ? resolveColor(props.accentColor, theme.colors)\n : theme.colors.primary;\n const totalPages = hasSecondPage(sections) ? 2 : 1;\n\n return (\n <Document title={`${props.clinicName} — Patient Intake Form`}>\n <FirstPage\n clinicAddress={props.clinicAddress}\n clinicLogo={props.clinicLogo}\n clinicName={props.clinicName}\n clinicPhone={props.clinicPhone}\n sections={sections}\n totalPages={totalPages}\n />\n {totalPages > 1 ? (\n <SecondPage\n accent={accent}\n accentColor={props.accentColor}\n clinicAddress={props.clinicAddress}\n clinicName={props.clinicName}\n clinicPhone={props.clinicPhone}\n sections={sections}\n totalPages={totalPages}\n />\n ) : null}\n </Document>\n );\n};\n\n/**\n * Print-ready medical intake form with patient, emergency contact, insurance,\n * medical history, medication, allergy, reason for visit, and consent\n * sections. Every section can be hidden through its boolean prop, and all\n * fields are left blank for the patient to complete by hand.\n */\nexport const MedicalIntakeFormDocument = ({\n theme,\n ...props\n}: MedicalIntakeFormProps) => (\n <PdfcnThemeProvider theme={theme}>\n <MedicalIntakeFormContent {...props} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/medical-intake-form/medical-intake-form.tsx"
},
{
"path": "registry/bases/takumi/blocks/medical-intake-form/medical-intake-form.types.ts",
- "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\n/**\n * Medical intake form properties.\n * Props - `clinicName` | `clinicLogo` | `clinicAddress` | `clinicPhone` |\n * `personalInfo` | `emergencyContact` | `insurance` | `medicalHistory` |\n * `medications` | `allergies` | `reasonForVisit` | `consent` | `accentColor` | `theme`\n * @see {@link MedicalIntakeFormDocument}\n */\nexport interface MedicalIntakeFormProps {\n clinicName: string;\n clinicLogo?: string;\n clinicAddress?: string;\n clinicPhone?: string;\n /**\n * @default true\n */\n personalInfo?: boolean;\n /**\n * @default true\n */\n emergencyContact?: boolean;\n /**\n * @default true\n */\n insurance?: boolean;\n /**\n * @default true\n */\n medicalHistory?: boolean;\n /**\n * @default true\n */\n medications?: boolean;\n /**\n * @default true\n */\n allergies?: boolean;\n /**\n * @default true\n */\n reasonForVisit?: boolean;\n /**\n * @default true\n */\n consent?: boolean;\n /**\n * Theme color token (e.g. `\"primary\"`) or raw CSS color (e.g. `\"#0d9488\"`)\n * applied to section rules, table accents, and the consent callout.\n */\n accentColor?: string;\n theme?: PdfcnTheme;\n}\n",
+ "content": "import type { PdfcnTheme } from \"@/types/pdf-themes\";\n\n/**\n * Medical intake form properties.\n * Props - `clinicName` | `clinicLogo` | `clinicAddress` | `clinicPhone` |\n * `personalInfo` | `emergencyContact` | `insurance` | `medicalHistory` |\n * `medications` | `allergies` | `reasonForVisit` | `consent` | `accentColor` | `theme`\n * @see {@link MedicalIntakeFormDocument}\n */\nexport interface MedicalIntakeFormProps {\n clinicName: string;\n clinicLogo?: string;\n clinicAddress?: string;\n clinicPhone?: string;\n /**\n * @default true\n */\n personalInfo?: boolean;\n /**\n * @default true\n */\n emergencyContact?: boolean;\n /**\n * @default true\n */\n insurance?: boolean;\n /**\n * @default true\n */\n medicalHistory?: boolean;\n /**\n * @default true\n */\n medications?: boolean;\n /**\n * @default true\n */\n allergies?: boolean;\n /**\n * @default true\n */\n reasonForVisit?: boolean;\n /**\n * @default true\n */\n consent?: boolean;\n /**\n * Theme color token (e.g. `\"primary\"`) or raw CSS color (e.g. `\"#0d9488\"`)\n * applied to section rules, table accents, and the consent callout.\n */\n accentColor?: string;\n theme?: PdfcnTheme;\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/medical-intake-form/medical-intake-form.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/meeting-minutes.json b/apps/web/public/r/takumi/meeting-minutes.json
index 040d5f5..fe99690 100644
--- a/apps/web/public/r/takumi/meeting-minutes.json
+++ b/apps/web/public/r/takumi/meeting-minutes.json
@@ -20,7 +20,7 @@
"files": [
{
"path": "registry/bases/takumi/blocks/meeting-minutes/meeting-minutes.tsx",
- "content": "import { Badge } from \"@/registry/bases/takumi/components/badge/badge\";\nimport { PdfList } from \"@/registry/bases/takumi/components/list/list\";\nimport { PageFooter } from \"@/registry/bases/takumi/components/page-footer/page-footer\";\nimport { PageHeader } from \"@/registry/bases/takumi/components/page-header/page-header\";\nimport { Section } from \"@/registry/bases/takumi/components/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/registry/bases/takumi/components/table/table\";\nimport { Text } from \"@/registry/bases/takumi/components/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type {\n MeetingMinutesActionStatus,\n MeetingMinutesProps,\n} from \"./meeting-minutes.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: MeetingMinutesProps = {\n absent: [{ name: \"Casey Wu\", role: \"QA Lead\" }],\n accentColor: \"#0891b2\",\n actionItems: [\n {\n dueDate: \"Sep 19, 2026\",\n owner: \"Jordan Lee\",\n status: \"In Progress\",\n task: \"Create pdfme integration RFC\",\n },\n {\n dueDate: \"Sep 22, 2026\",\n owner: \"Sam Patel\",\n status: \"Not Started\",\n task: \"Design community page wireframes\",\n },\n {\n dueDate: \"Sep 26, 2026\",\n owner: \"Alex Kim\",\n status: \"Complete\",\n task: \"Share Q2 outcomes deck with stakeholders\",\n },\n ],\n agenda: [\n \"Review Q2 outcomes\",\n \"Q3 feature priorities\",\n \"Resource allocation\",\n \"Timeline and milestones\",\n ],\n attendees: [\n { name: \"Alex Kim\", role: \"Product Lead\" },\n { name: \"Jordan Lee\", role: \"Engineering Lead\" },\n { name: \"Sam Patel\", role: \"Design Lead\" },\n ],\n date: \"September 12, 2026\",\n decisions: [\n {\n decision: \"Proceed with pdfme as second rendering base\",\n number: 1,\n rationale: \"Better JSX support\",\n },\n {\n decision: \"Allocate 2 engineers to PDF module full-time\",\n number: 2,\n },\n ],\n discussions: [\n {\n notes: [\n \"Shipped 4 of 5 planned features\",\n \"Customer satisfaction up 12%\",\n ],\n speaker: \"Alex Kim\",\n topic: \"Q2 Outcomes\",\n },\n {\n notes: [\n \"PDF generation module is top priority\",\n \"Community page scheduled for late Q3\",\n ],\n speaker: \"Jordan Lee\",\n topic: \"Q3 Feature Priorities\",\n },\n ],\n distributionList: [\"[email protected]\", \"[email protected]\"],\n guests: [\"Riya Shah (Advisor)\"],\n location: \"Conference Room B / Zoom\",\n meetingTitle: \"Q3 Product Roadmap Review\",\n nextMeeting: {\n agenda: [\"Review action items\", \"pdfme RFC walkthrough\"],\n date: \"September 19, 2026\",\n time: \"2:00 PM\",\n },\n organizer: \"Alex Kim\",\n preparedBy: \"Alex Kim\",\n time: \"2:00 PM - 3:30 PM\",\n};\n\nconst STATUS_VARIANT: Record<\n MeetingMinutesActionStatus,\n \"success\" | \"info\" | \"default\"\n> = {\n Complete: \"success\",\n \"In Progress\": \"info\",\n \"Not Started\": \"default\",\n};\n\nconst formatAttendee = (a: { name: string; role?: string }) =>\n `${a.name}${a.role ? ` — ${a.role}` : \"\"}`;\n\nconst MeetingMinutesContent = ({ data }: { data: MeetingMinutesProps }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n columnHeading: {\n fontSize: 9,\n fontWeight: \"bold\",\n marginBottom: 2,\n },\n discussionTopic: {\n marginBottom: theme.primitives.spacing[2],\n },\n listItem: {\n marginBottom: theme.primitives.spacing[1],\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n });\n\n const attendeeColumns = [\n { heading: \"Attendees\", names: data.attendees.map(formatAttendee) },\n ...(data.absent?.length\n ? [{ heading: \"Absent\", names: data.absent.map(formatAttendee) }]\n : []),\n ...(data.guests?.length ? [{ heading: \"Guests\", names: data.guests }] : []),\n ];\n\n return (\n <Document title={`Minutes — ${data.meetingTitle}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"simple\"\n title={data.meetingTitle}\n subtitle={`${data.location} · Organized by ${data.organizer}`}\n rightText={data.date}\n rightSubText={data.time}\n style={{ marginBottom: 0 }}\n />\n <Section spacing=\"sm\" style={{ flexDirection: \"row\" }}>\n {attendeeColumns.map((column) => (\n <View key={column.heading} style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n {column.heading}\n </Text>\n {column.names.map((name) => (\n <Text key={name} noMargin variant=\"xs\">\n {name}\n </Text>\n ))}\n </View>\n ))}\n </Section>\n <Section spacing=\"sm\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Agenda\n </Text>\n {data.agenda.map((item, index) => (\n <Text key={item} style={styles.listItem} variant=\"sm\" noMargin>\n {`${index + 1}. ${item}`}\n </Text>\n ))}\n </Section>\n <Section spacing=\"sm\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Discussion\n </Text>\n {data.discussions.map((discussion) => (\n <View key={discussion.topic} style={styles.discussionTopic}>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {discussion.topic}\n </Text>\n {discussion.speaker && (\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {`— ${discussion.speaker}`}\n </Text>\n )}\n <PdfList\n variant=\"bullet\"\n gap=\"xs\"\n items={discussion.notes.map((text) => ({ text }))}\n />\n </View>\n ))}\n </Section>\n <PageFooter\n leftText={`Prepared by ${data.preparedBy}`}\n rightText={\n data.distributionList?.length\n ? `Distribution: ${data.distributionList.join(\", \")}`\n : undefined\n }\n sticky\n pagePadding={25}\n />\n </Page>\n <Page size=\"A4\" style={styles.page}>\n <Section spacing=\"sm\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Decisions\n </Text>\n {data.decisions.map((d) => (\n <View key={d.number} style={styles.discussionTopic}>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {`${d.number}. ${d.decision}`}\n </Text>\n {d.rationale && (\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {d.rationale}\n </Text>\n )}\n </View>\n ))}\n </Section>\n <Section spacing=\"sm\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Action Items\n </Text>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Task</TableCell>\n <TableCell align=\"center\">Owner</TableCell>\n <TableCell align=\"center\">Due Date</TableCell>\n <TableCell align=\"center\">Status</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.actionItems.map((item) => (\n <TableRow key={item.task}>\n <TableCell>{item.task}</TableCell>\n <TableCell align=\"center\">{item.owner}</TableCell>\n <TableCell align=\"center\">{item.dueDate}</TableCell>\n <TableCell align=\"center\">\n <Badge\n variant={STATUS_VARIANT[item.status]}\n size=\"sm\"\n label={item.status}\n />\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </Section>\n {data.nextMeeting && (\n <Section\n spacing=\"sm\"\n variant=\"highlight\"\n accentColor={data.accentColor}\n >\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Next Meeting\n </Text>\n <Text variant=\"sm\" weight=\"medium\" noMargin>\n {`${data.nextMeeting.date} · ${data.nextMeeting.time}`}\n </Text>\n {data.nextMeeting.agenda && (\n <PdfList\n variant=\"bullet\"\n gap=\"xs\"\n items={data.nextMeeting.agenda.map((text) => ({ text }))}\n />\n )}\n </Section>\n )}\n <PageFooter\n leftText={`Prepared by ${data.preparedBy}`}\n rightText={\n data.distributionList?.length\n ? `Distribution: ${data.distributionList.join(\", \")}`\n : undefined\n }\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const MeetingMinutesDocument = ({\n theme,\n data,\n ...props\n}: {\n theme?: PdfcnTheme;\n data?: MeetingMinutesProps;\n} & Partial<MeetingMinutesProps>) => (\n <PdfcnThemeProvider theme={theme}>\n <MeetingMinutesContent data={{ ...sampleData, ...data, ...props }} />\n </PdfcnThemeProvider>\n);\n",
+ "content": "import { Badge } from \"@/components/pdf/badge/badge\";\nimport { PdfList } from \"@/components/pdf/list/list\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type {\n MeetingMinutesActionStatus,\n MeetingMinutesProps,\n} from \"./meeting-minutes.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: MeetingMinutesProps = {\n absent: [{ name: \"Casey Wu\", role: \"QA Lead\" }],\n accentColor: \"#0891b2\",\n actionItems: [\n {\n dueDate: \"Sep 19, 2026\",\n owner: \"Jordan Lee\",\n status: \"In Progress\",\n task: \"Create pdfme integration RFC\",\n },\n {\n dueDate: \"Sep 22, 2026\",\n owner: \"Sam Patel\",\n status: \"Not Started\",\n task: \"Design community page wireframes\",\n },\n {\n dueDate: \"Sep 26, 2026\",\n owner: \"Alex Kim\",\n status: \"Complete\",\n task: \"Share Q2 outcomes deck with stakeholders\",\n },\n ],\n agenda: [\n \"Review Q2 outcomes\",\n \"Q3 feature priorities\",\n \"Resource allocation\",\n \"Timeline and milestones\",\n ],\n attendees: [\n { name: \"Alex Kim\", role: \"Product Lead\" },\n { name: \"Jordan Lee\", role: \"Engineering Lead\" },\n { name: \"Sam Patel\", role: \"Design Lead\" },\n ],\n date: \"September 12, 2026\",\n decisions: [\n {\n decision: \"Proceed with pdfme as second rendering base\",\n number: 1,\n rationale: \"Better JSX support\",\n },\n {\n decision: \"Allocate 2 engineers to PDF module full-time\",\n number: 2,\n },\n ],\n discussions: [\n {\n notes: [\n \"Shipped 4 of 5 planned features\",\n \"Customer satisfaction up 12%\",\n ],\n speaker: \"Alex Kim\",\n topic: \"Q2 Outcomes\",\n },\n {\n notes: [\n \"PDF generation module is top priority\",\n \"Community page scheduled for late Q3\",\n ],\n speaker: \"Jordan Lee\",\n topic: \"Q3 Feature Priorities\",\n },\n ],\n distributionList: [\"[email protected]\", \"[email protected]\"],\n guests: [\"Riya Shah (Advisor)\"],\n location: \"Conference Room B / Zoom\",\n meetingTitle: \"Q3 Product Roadmap Review\",\n nextMeeting: {\n agenda: [\"Review action items\", \"pdfme RFC walkthrough\"],\n date: \"September 19, 2026\",\n time: \"2:00 PM\",\n },\n organizer: \"Alex Kim\",\n preparedBy: \"Alex Kim\",\n time: \"2:00 PM - 3:30 PM\",\n};\n\nconst STATUS_VARIANT: Record<\n MeetingMinutesActionStatus,\n \"success\" | \"info\" | \"default\"\n> = {\n Complete: \"success\",\n \"In Progress\": \"info\",\n \"Not Started\": \"default\",\n};\n\nconst formatAttendee = (a: { name: string; role?: string }) =>\n `${a.name}${a.role ? ` — ${a.role}` : \"\"}`;\n\nconst MeetingMinutesContent = ({ data }: { data: MeetingMinutesProps }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n columnHeading: {\n fontSize: 9,\n fontWeight: \"bold\",\n marginBottom: 2,\n },\n discussionTopic: {\n marginBottom: theme.primitives.spacing[2],\n },\n listItem: {\n marginBottom: theme.primitives.spacing[1],\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n });\n\n const attendeeColumns = [\n { heading: \"Attendees\", names: data.attendees.map(formatAttendee) },\n ...(data.absent?.length\n ? [{ heading: \"Absent\", names: data.absent.map(formatAttendee) }]\n : []),\n ...(data.guests?.length ? [{ heading: \"Guests\", names: data.guests }] : []),\n ];\n\n return (\n <Document title={`Minutes — ${data.meetingTitle}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"simple\"\n title={data.meetingTitle}\n subtitle={`${data.location} · Organized by ${data.organizer}`}\n rightText={data.date}\n rightSubText={data.time}\n style={{ marginBottom: 0 }}\n />\n <Section spacing=\"sm\" style={{ flexDirection: \"row\" }}>\n {attendeeColumns.map((column) => (\n <View key={column.heading} style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n {column.heading}\n </Text>\n {column.names.map((name) => (\n <Text key={name} noMargin variant=\"xs\">\n {name}\n </Text>\n ))}\n </View>\n ))}\n </Section>\n <Section spacing=\"sm\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Agenda\n </Text>\n {data.agenda.map((item, index) => (\n <Text key={item} style={styles.listItem} variant=\"sm\" noMargin>\n {`${index + 1}. ${item}`}\n </Text>\n ))}\n </Section>\n <Section spacing=\"sm\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Discussion\n </Text>\n {data.discussions.map((discussion) => (\n <View key={discussion.topic} style={styles.discussionTopic}>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {discussion.topic}\n </Text>\n {discussion.speaker && (\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {`— ${discussion.speaker}`}\n </Text>\n )}\n <PdfList\n variant=\"bullet\"\n gap=\"xs\"\n items={discussion.notes.map((text) => ({ text }))}\n />\n </View>\n ))}\n </Section>\n <PageFooter\n leftText={`Prepared by ${data.preparedBy}`}\n rightText={\n data.distributionList?.length\n ? `Distribution: ${data.distributionList.join(\", \")}`\n : undefined\n }\n sticky\n pagePadding={25}\n />\n </Page>\n <Page size=\"A4\" style={styles.page}>\n <Section spacing=\"sm\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Decisions\n </Text>\n {data.decisions.map((d) => (\n <View key={d.number} style={styles.discussionTopic}>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {`${d.number}. ${d.decision}`}\n </Text>\n {d.rationale && (\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {d.rationale}\n </Text>\n )}\n </View>\n ))}\n </Section>\n <Section spacing=\"sm\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Action Items\n </Text>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Task</TableCell>\n <TableCell align=\"center\">Owner</TableCell>\n <TableCell align=\"center\">Due Date</TableCell>\n <TableCell align=\"center\">Status</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.actionItems.map((item) => (\n <TableRow key={item.task}>\n <TableCell>{item.task}</TableCell>\n <TableCell align=\"center\">{item.owner}</TableCell>\n <TableCell align=\"center\">{item.dueDate}</TableCell>\n <TableCell align=\"center\">\n <Badge\n variant={STATUS_VARIANT[item.status]}\n size=\"sm\"\n label={item.status}\n />\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </Section>\n {data.nextMeeting && (\n <Section\n spacing=\"sm\"\n variant=\"highlight\"\n accentColor={data.accentColor}\n >\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Next Meeting\n </Text>\n <Text variant=\"sm\" weight=\"medium\" noMargin>\n {`${data.nextMeeting.date} · ${data.nextMeeting.time}`}\n </Text>\n {data.nextMeeting.agenda && (\n <PdfList\n variant=\"bullet\"\n gap=\"xs\"\n items={data.nextMeeting.agenda.map((text) => ({ text }))}\n />\n )}\n </Section>\n )}\n <PageFooter\n leftText={`Prepared by ${data.preparedBy}`}\n rightText={\n data.distributionList?.length\n ? `Distribution: ${data.distributionList.join(\", \")}`\n : undefined\n }\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const MeetingMinutesDocument = ({\n theme,\n data,\n ...props\n}: {\n theme?: PdfcnTheme;\n data?: MeetingMinutesProps;\n} & Partial<MeetingMinutesProps>) => (\n <PdfcnThemeProvider theme={theme}>\n <MeetingMinutesContent data={{ ...sampleData, ...data, ...props }} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/meeting-minutes/meeting-minutes.tsx"
},
@@ -32,4 +32,4 @@
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/packing-slip.json b/apps/web/public/r/takumi/packing-slip.json
index 5569b0a..2dabf7e 100644
--- a/apps/web/public/r/takumi/packing-slip.json
+++ b/apps/web/public/r/takumi/packing-slip.json
@@ -20,7 +20,7 @@
"files": [
{
"path": "registry/bases/takumi/blocks/packing-slip/packing-slip.tsx",
- "content": "import { KeyValue } from \"@/registry/bases/takumi/components/key-value/key-value\";\nimport { PageFooter } from \"@/registry/bases/takumi/components/page-footer/page-footer\";\nimport { PageHeader } from \"@/registry/bases/takumi/components/page-header/page-header\";\nimport { PdfImage } from \"@/registry/bases/takumi/components/pdf-image/pdf-image\";\nimport { Section } from \"@/registry/bases/takumi/components/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/registry/bases/takumi/components/table/table\";\nimport { Text } from \"@/registry/bases/takumi/components/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type { PackingSlipProps, PackingSlipSender } from \"./packing-slip.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: PackingSlipProps = {\n accentColor: \"#059669\",\n companyName: \"Acme Store\",\n customerService: \"[email protected]\",\n items: [\n {\n name: \"Widget Pro\",\n qtyOrdered: 2,\n qtyPacked: 2,\n sku: \"WP-001\",\n unitPrice: 49.99,\n },\n {\n name: \"Gadget Lite\",\n qtyOrdered: 1,\n qtyPacked: 1,\n sku: \"GL-010\",\n unitPrice: 29.99,\n },\n {\n name: \"Cable Kit\",\n qtyOrdered: 3,\n qtyPacked: 2,\n sku: \"CK-204\",\n unitPrice: 9.5,\n },\n ],\n orderDate: \"Sep 10, 2026\",\n orderNumber: \"ORD-2026-0891\",\n poNumber: \"PO-4471\",\n returnsPolicy: \"Returns accepted within 30 days with original packaging.\",\n shipFrom: {\n address: \"100 Industrial Blvd\",\n city: \"Seattle\",\n name: \"Acme Warehouse\",\n state: \"WA\",\n zip: \"98101\",\n },\n shipTo: {\n address: \"456 Oak Ave\",\n city: \"Portland\",\n name: \"Jane Doe\",\n phone: \"(503) 555-0142\",\n state: \"OR\",\n zip: \"97201\",\n },\n shipping: {\n carrier: \"UPS\",\n estimatedDelivery: \"Sep 15, 2026\",\n method: \"Ground\",\n trackingNumber: \"1Z999AA10123456784\",\n },\n thankYouMessage: \"Thank you for your order!\",\n totalPackages: 1,\n totalWeight: \"3.2 kg\",\n};\n\nconst formatAddress = (a: PackingSlipSender & { country?: string }) =>\n `${a.address}, ${a.city}, ${a.state} ${a.zip}${a.country ? `, ${a.country}` : \"\"}`;\n\nconst PackingSlipContent = ({ data }: { data: PackingSlipProps }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n columnHeading: {\n fontSize: 9,\n fontWeight: \"bold\",\n marginBottom: 2,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n });\n\n const totalPacked = data.items.reduce((sum, item) => sum + item.qtyPacked, 0);\n const totalOrdered = data.items.reduce(\n (sum, item) => sum + item.qtyOrdered,\n 0\n );\n\n const summaryItems = [\n { key: \"Items Packed\", value: `${totalPacked} of ${totalOrdered}` },\n ...(data.totalPackages === undefined\n ? []\n : [{ key: \"Packages\", value: `${data.totalPackages}` }]),\n ...(data.totalWeight\n ? [{ key: \"Total Weight\", value: data.totalWeight }]\n : []),\n ];\n\n return (\n <Document title={`Packing Slip ${data.orderNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"logo-left\"\n logo={\n data.companyLogo ? (\n <PdfImage src={data.companyLogo} style={{ margin: 0 }} />\n ) : undefined\n }\n title=\"PACKING SLIP\"\n subtitle={data.companyName}\n rightText={data.orderNumber}\n rightSubText={`Order Date: ${data.orderDate}`}\n style={{ marginBottom: 0 }}\n />\n <Section noWrap style={{ flexDirection: \"row\" }}>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Ship To\n </Text>\n <Text noMargin variant=\"xs\">\n {data.shipTo.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {formatAddress(data.shipTo)}\n </Text>\n {data.shipTo.phone && (\n <Text noMargin variant=\"xs\">\n {data.shipTo.phone}\n </Text>\n )}\n </View>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n From\n </Text>\n <Text noMargin variant=\"xs\">\n {data.shipFrom.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {formatAddress(data.shipFrom)}\n </Text>\n </View>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Order\n </Text>\n <Text noMargin variant=\"xs\">\n {data.orderNumber}\n </Text>\n {data.poNumber && (\n <Text noMargin variant=\"xs\">\n {`PO: ${data.poNumber}`}\n </Text>\n )}\n </View>\n </Section>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Item</TableCell>\n <TableCell align=\"center\">SKU</TableCell>\n <TableCell align=\"center\">Packed</TableCell>\n <TableCell align=\"center\">Ordered</TableCell>\n <TableCell align=\"right\">Unit Price</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item) => (\n <TableRow key={item.sku}>\n <TableCell>{item.name}</TableCell>\n <TableCell align=\"center\">{item.sku}</TableCell>\n <TableCell align=\"center\">{`${item.qtyPacked}`}</TableCell>\n <TableCell align=\"center\">{`${item.qtyOrdered}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toFixed(2)}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.qtyPacked * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 16 }}>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Shipping\n </Text>\n <Text noMargin variant=\"xs\">\n {`${data.shipping.carrier} — ${data.shipping.method}`}\n </Text>\n <Text noMargin variant=\"xs\">\n {`Tracking: ${data.shipping.trackingNumber}`}\n </Text>\n {data.shipping.estimatedDelivery && (\n <Text noMargin variant=\"xs\">\n {`Est. Delivery: ${data.shipping.estimatedDelivery}`}\n </Text>\n )}\n </View>\n <View style={{ marginLeft: \"auto\", width: 220 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={summaryItems}\n divided\n />\n </View>\n </Section>\n {(data.thankYouMessage || data.returnsPolicy) && (\n <Section\n spacing=\"sm\"\n variant=\"highlight\"\n accentColor={data.accentColor}\n >\n {data.thankYouMessage && (\n <Text variant=\"sm\" weight=\"medium\" noMargin>\n {data.thankYouMessage}\n </Text>\n )}\n {data.returnsPolicy && (\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {data.returnsPolicy}\n </Text>\n )}\n </Section>\n )}\n <PageFooter\n leftText={data.customerService ?? data.companyName}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const PackingSlipDocument = ({\n theme,\n data,\n ...props\n}: {\n theme?: PdfcnTheme;\n data?: PackingSlipProps;\n} & Partial<PackingSlipProps>) => (\n <PdfcnThemeProvider theme={theme}>\n <PackingSlipContent data={{ ...sampleData, ...data, ...props }} />\n </PdfcnThemeProvider>\n);\n",
+ "content": "import { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { PdfImage } from \"@/components/pdf/pdf-image/pdf-image\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { PackingSlipProps, PackingSlipSender } from \"./packing-slip.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: PackingSlipProps = {\n accentColor: \"#059669\",\n companyName: \"Acme Store\",\n customerService: \"[email protected]\",\n items: [\n {\n name: \"Widget Pro\",\n qtyOrdered: 2,\n qtyPacked: 2,\n sku: \"WP-001\",\n unitPrice: 49.99,\n },\n {\n name: \"Gadget Lite\",\n qtyOrdered: 1,\n qtyPacked: 1,\n sku: \"GL-010\",\n unitPrice: 29.99,\n },\n {\n name: \"Cable Kit\",\n qtyOrdered: 3,\n qtyPacked: 2,\n sku: \"CK-204\",\n unitPrice: 9.5,\n },\n ],\n orderDate: \"Sep 10, 2026\",\n orderNumber: \"ORD-2026-0891\",\n poNumber: \"PO-4471\",\n returnsPolicy: \"Returns accepted within 30 days with original packaging.\",\n shipFrom: {\n address: \"100 Industrial Blvd\",\n city: \"Seattle\",\n name: \"Acme Warehouse\",\n state: \"WA\",\n zip: \"98101\",\n },\n shipTo: {\n address: \"456 Oak Ave\",\n city: \"Portland\",\n name: \"Jane Doe\",\n phone: \"(503) 555-0142\",\n state: \"OR\",\n zip: \"97201\",\n },\n shipping: {\n carrier: \"UPS\",\n estimatedDelivery: \"Sep 15, 2026\",\n method: \"Ground\",\n trackingNumber: \"1Z999AA10123456784\",\n },\n thankYouMessage: \"Thank you for your order!\",\n totalPackages: 1,\n totalWeight: \"3.2 kg\",\n};\n\nconst formatAddress = (a: PackingSlipSender & { country?: string }) =>\n `${a.address}, ${a.city}, ${a.state} ${a.zip}${a.country ? `, ${a.country}` : \"\"}`;\n\nconst PackingSlipContent = ({ data }: { data: PackingSlipProps }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n columnHeading: {\n fontSize: 9,\n fontWeight: \"bold\",\n marginBottom: 2,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n });\n\n const totalPacked = data.items.reduce((sum, item) => sum + item.qtyPacked, 0);\n const totalOrdered = data.items.reduce(\n (sum, item) => sum + item.qtyOrdered,\n 0\n );\n\n const summaryItems = [\n { key: \"Items Packed\", value: `${totalPacked} of ${totalOrdered}` },\n ...(data.totalPackages === undefined\n ? []\n : [{ key: \"Packages\", value: `${data.totalPackages}` }]),\n ...(data.totalWeight\n ? [{ key: \"Total Weight\", value: data.totalWeight }]\n : []),\n ];\n\n return (\n <Document title={`Packing Slip ${data.orderNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"logo-left\"\n logo={\n data.companyLogo ? (\n <PdfImage src={data.companyLogo} style={{ margin: 0 }} />\n ) : undefined\n }\n title=\"PACKING SLIP\"\n subtitle={data.companyName}\n rightText={data.orderNumber}\n rightSubText={`Order Date: ${data.orderDate}`}\n style={{ marginBottom: 0 }}\n />\n <Section noWrap style={{ flexDirection: \"row\" }}>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Ship To\n </Text>\n <Text noMargin variant=\"xs\">\n {data.shipTo.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {formatAddress(data.shipTo)}\n </Text>\n {data.shipTo.phone && (\n <Text noMargin variant=\"xs\">\n {data.shipTo.phone}\n </Text>\n )}\n </View>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n From\n </Text>\n <Text noMargin variant=\"xs\">\n {data.shipFrom.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {formatAddress(data.shipFrom)}\n </Text>\n </View>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Order\n </Text>\n <Text noMargin variant=\"xs\">\n {data.orderNumber}\n </Text>\n {data.poNumber && (\n <Text noMargin variant=\"xs\">\n {`PO: ${data.poNumber}`}\n </Text>\n )}\n </View>\n </Section>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Item</TableCell>\n <TableCell align=\"center\">SKU</TableCell>\n <TableCell align=\"center\">Packed</TableCell>\n <TableCell align=\"center\">Ordered</TableCell>\n <TableCell align=\"right\">Unit Price</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item) => (\n <TableRow key={item.sku}>\n <TableCell>{item.name}</TableCell>\n <TableCell align=\"center\">{item.sku}</TableCell>\n <TableCell align=\"center\">{`${item.qtyPacked}`}</TableCell>\n <TableCell align=\"center\">{`${item.qtyOrdered}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toFixed(2)}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.qtyPacked * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 16 }}>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Shipping\n </Text>\n <Text noMargin variant=\"xs\">\n {`${data.shipping.carrier} — ${data.shipping.method}`}\n </Text>\n <Text noMargin variant=\"xs\">\n {`Tracking: ${data.shipping.trackingNumber}`}\n </Text>\n {data.shipping.estimatedDelivery && (\n <Text noMargin variant=\"xs\">\n {`Est. Delivery: ${data.shipping.estimatedDelivery}`}\n </Text>\n )}\n </View>\n <View style={{ marginLeft: \"auto\", width: 220 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={summaryItems}\n divided\n />\n </View>\n </Section>\n {(data.thankYouMessage || data.returnsPolicy) && (\n <Section\n spacing=\"sm\"\n variant=\"highlight\"\n accentColor={data.accentColor}\n >\n {data.thankYouMessage && (\n <Text variant=\"sm\" weight=\"medium\" noMargin>\n {data.thankYouMessage}\n </Text>\n )}\n {data.returnsPolicy && (\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {data.returnsPolicy}\n </Text>\n )}\n </Section>\n )}\n <PageFooter\n leftText={data.customerService ?? data.companyName}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const PackingSlipDocument = ({\n theme,\n data,\n ...props\n}: {\n theme?: PdfcnTheme;\n data?: PackingSlipProps;\n} & Partial<PackingSlipProps>) => (\n <PdfcnThemeProvider theme={theme}>\n <PackingSlipContent data={{ ...sampleData, ...data, ...props }} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/packing-slip/packing-slip.tsx"
},
@@ -32,4 +32,4 @@
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/page-break.json b/apps/web/public/r/takumi/page-break.json
index 2d010a2..67b40c2 100644
--- a/apps/web/public/r/takumi/page-break.json
+++ b/apps/web/public/r/takumi/page-break.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/takumi/components/page-break/page-break.tsx",
- "content": "import { View } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\n\r\nexport interface PageBreakProps extends Omit<PDFComponentProps, \"children\"> {\r\n children?: never;\r\n}\r\n\r\nexport const PageBreak = ({ style }: PageBreakProps) => (\r\n <View style={[{ breakBefore: \"page\" }, style].filter(Boolean) as never} />\r\n);\r\n",
+ "content": "import { View } from \"@/lib/pdf-primitives\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\n\nexport interface PageBreakProps extends Omit<PDFComponentProps, \"children\"> {\n children?: never;\n}\n\nexport const PageBreak = ({ style }: PageBreakProps) => (\n <View style={[{ breakBefore: \"page\" }, style].filter(Boolean) as never} />\n);\n",
"type": "registry:component",
"target": "components/pdf/page-break/page-break.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/page-footer.json b/apps/web/public/r/takumi/page-footer.json
index cbd4b41..6548179 100644
--- a/apps/web/public/r/takumi/page-footer.json
+++ b/apps/web/public/r/takumi/page-footer.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/takumi/components/page-footer/page-footer.tsx",
- "content": "import type { ReactNode } from \"react\";\r\n\r\nimport {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n Text as PDFText,\r\n StyleSheet,\r\n View,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type PageFooterVariant =\r\n | \"simple\"\r\n | \"centered\"\r\n | \"branded\"\r\n | \"minimal\"\r\n | \"three-column\"\r\n | \"detailed\";\r\n\r\n/**\r\n * Footer row with layout variants, optional sticky or fixed positioning, and contact info support.\r\n * Props - `leftText` | `rightText` | `centerText` | `variant` | `background` | `textColor` | `marginTop` | `address` | `phone` | `email` | `website` | `fixed` | `sticky` | `pagePadding` | `noWrap` | `style`\r\n * @see {@link PageFooterProps}\r\n */\r\nexport interface PageFooterProps extends Omit<PDFComponentProps, \"children\"> {\r\n leftText?: ReactNode;\r\n rightText?: ReactNode;\r\n centerText?: ReactNode;\r\n /**\r\n * @default 'simple'\r\n */\r\n variant?: PageFooterVariant;\r\n background?: string;\r\n textColor?: string;\r\n marginTop?: number;\r\n address?: string;\r\n phone?: string;\r\n email?: string;\r\n website?: string;\r\n /**\r\n * @default false\r\n */\r\n fixed?: boolean;\r\n /**\r\n * @default false\r\n */\r\n sticky?: boolean;\r\n /**\r\n * @default 0\r\n */\r\n pagePadding?: number;\r\n /**\r\n * @default true\r\n */\r\n noWrap?: boolean;\r\n}\r\n\r\nconst createPageFooterStyles = (t: PdfcnTheme) => {\r\n const { spacing, fontWeights } = t.primitives;\r\n const c = t.colors;\r\n const { body } = t.typography;\r\n\r\n const textBase = {\r\n color: c.mutedForeground,\r\n fontFamily: body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n lineHeight: body.lineHeight,\r\n };\r\n\r\n return StyleSheet.create({\r\n brandedContainer: {\r\n alignItems: \"center\",\r\n backgroundColor: c.primary,\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n paddingHorizontal: spacing[4],\r\n paddingVertical: spacing[3],\r\n },\r\n\r\n centeredContainer: {\r\n alignItems: \"center\",\r\n borderTopColor: c.border,\r\n borderTopStyle: \"solid\",\r\n borderTopWidth: spacing[0.5],\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n paddingTop: spacing[3],\r\n },\r\n\r\n companyBold: {\r\n ...textBase,\r\n color: c.foreground,\r\n fontWeight: fontWeights.bold,\r\n },\r\n\r\n companyName: {\r\n ...textBase,\r\n color: c.foreground,\r\n fontWeight: fontWeights.medium,\r\n },\r\n\r\n contactInfoCenter: {\r\n ...textBase,\r\n fontSize: t.primitives.typography.xs - 1,\r\n marginTop: spacing[0.5],\r\n textAlign: \"center\",\r\n },\r\n detailedContainer: {\r\n borderTopColor: c.border,\r\n borderTopStyle: \"solid\",\r\n borderTopWidth: spacing[1],\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n paddingTop: spacing[3],\r\n },\r\n detailedLeft: {\r\n display: \"flex\",\r\n flex: 1,\r\n flexDirection: \"column\",\r\n },\r\n detailedPageNumber: {\r\n ...textBase,\r\n borderTopColor: c.border,\r\n borderTopStyle: \"solid\",\r\n borderTopWidth: spacing[0.5],\r\n paddingTop: spacing[2],\r\n textAlign: \"center\",\r\n },\r\n detailedRight: {\r\n alignItems: \"flex-end\",\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n },\r\n detailedTopRow: {\r\n alignItems: \"flex-start\",\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n marginBottom: spacing[2],\r\n },\r\n\r\n minimalContainer: {\r\n alignItems: \"center\",\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n paddingBottom: spacing[1],\r\n paddingTop: spacing[1],\r\n },\r\n simpleContainer: {\r\n alignItems: \"center\",\r\n borderTopColor: c.border,\r\n borderTopStyle: \"solid\",\r\n borderTopWidth: spacing[0.5],\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n paddingTop: spacing[3],\r\n },\r\n textBranded: {\r\n ...textBase,\r\n color: c.primaryForeground,\r\n fontWeight: fontWeights.medium,\r\n },\r\n textBrandedRight: {\r\n ...textBase,\r\n color: c.primaryForeground,\r\n textAlign: \"right\",\r\n },\r\n textCenter: {\r\n ...textBase,\r\n flex: 1,\r\n textAlign: \"center\",\r\n },\r\n textCenteredVariant: {\r\n ...textBase,\r\n marginBottom: spacing[1],\r\n textAlign: \"center\",\r\n },\r\n\r\n textLeft: {\r\n ...textBase,\r\n flex: 1,\r\n },\r\n textRight: {\r\n ...textBase,\r\n textAlign: \"right\",\r\n },\r\n threeColumnCenter: {\r\n alignItems: \"center\",\r\n display: \"flex\",\r\n flex: 1,\r\n flexDirection: \"column\",\r\n },\r\n threeColumnContainer: {\r\n alignItems: \"flex-start\",\r\n borderTopColor: c.border,\r\n borderTopStyle: \"solid\",\r\n borderTopWidth: spacing[0.5],\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n paddingTop: spacing[3],\r\n },\r\n threeColumnLeft: {\r\n display: \"flex\",\r\n flex: 1,\r\n flexDirection: \"column\",\r\n },\r\n threeColumnRight: {\r\n alignItems: \"flex-end\",\r\n display: \"flex\",\r\n flex: 1,\r\n flexDirection: \"column\",\r\n },\r\n });\r\n};\r\n\r\ntype Styles = ReturnType<typeof createPageFooterStyles>;\r\n\r\nconst applyTextColor = (\r\n styles: Style[],\r\n color: string | undefined\r\n): Style[] => {\r\n if (!color) {\r\n return styles;\r\n }\r\n return [...styles, { color }];\r\n};\r\n\r\nconst renderBranded = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n leftStyle: Style[],\r\n rightStyle: Style[],\r\n leftText: ReactNode,\r\n rightText: ReactNode,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles}>\r\n {leftText && <PDFText style={leftStyle}>{leftText}</PDFText>}\r\n {rightText && <PDFText style={rightStyle}>{rightText}</PDFText>}\r\n </View>\r\n);\r\n\r\nconst renderCentered = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n textStyle: Style[],\r\n leftText: ReactNode,\r\n rightText: ReactNode,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles}>\r\n {leftText && <PDFText style={textStyle}>{leftText}</PDFText>}\r\n {rightText && <PDFText style={textStyle}>{rightText}</PDFText>}\r\n </View>\r\n);\r\n\r\nconst renderThreeColumn = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n leftStyle: Style[],\r\n centerStyle: Style[],\r\n rightStyle: Style[],\r\n leftText: ReactNode,\r\n rightText: ReactNode,\r\n address: string | undefined,\r\n phone: string | undefined,\r\n email: string | undefined,\r\n website: string | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles}>\r\n <View style={styles.threeColumnLeft}>\r\n {leftText && <PDFText style={leftStyle}>{leftText}</PDFText>}\r\n {address && <PDFText style={styles.textLeft}>{address}</PDFText>}\r\n </View>\r\n <View style={styles.threeColumnCenter}>\r\n {phone && <PDFText style={centerStyle}>{phone}</PDFText>}\r\n {email && <PDFText style={centerStyle}>{email}</PDFText>}\r\n {website && <PDFText style={centerStyle}>{website}</PDFText>}\r\n </View>\r\n <View style={styles.threeColumnRight}>\r\n {rightText && <PDFText style={rightStyle}>{rightText}</PDFText>}\r\n </View>\r\n </View>\r\n);\r\n\r\nconst renderDetailed = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n companyStyle: Style[],\r\n addrStyle: Style[],\r\n contactStyle: Style[],\r\n pageNumStyle: Style[],\r\n leftText: ReactNode,\r\n rightText: ReactNode,\r\n address: string | undefined,\r\n phone: string | undefined,\r\n email: string | undefined,\r\n website: string | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles}>\r\n <View style={styles.detailedTopRow}>\r\n <View style={styles.detailedLeft}>\r\n {leftText && <PDFText style={companyStyle}>{leftText}</PDFText>}\r\n {address && <PDFText style={addrStyle}>{address}</PDFText>}\r\n </View>\r\n <View style={styles.detailedRight}>\r\n {phone && <PDFText style={contactStyle}>{`Phone: ${phone}`}</PDFText>}\r\n {email && <PDFText style={contactStyle}>{`Email: ${email}`}</PDFText>}\r\n {website && <PDFText style={contactStyle}>{`Web: ${website}`}</PDFText>}\r\n </View>\r\n </View>\r\n {rightText && <PDFText style={pageNumStyle}>{rightText}</PDFText>}\r\n </View>\r\n);\r\n\r\nconst renderMinimal = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n leftStyle: Style[],\r\n rightStyle: Style[],\r\n leftText: ReactNode,\r\n rightText: ReactNode,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles}>\r\n {leftText && <PDFText style={leftStyle}>{leftText}</PDFText>}\r\n {rightText && <PDFText style={rightStyle}>{rightText}</PDFText>}\r\n </View>\r\n);\r\n\r\nconst renderSimple = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n leftStyle: Style[],\r\n centerStyle: Style[],\r\n rightStyle: Style[],\r\n leftText: ReactNode,\r\n centerText: ReactNode,\r\n rightText: ReactNode,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles}>\r\n {leftText && <PDFText style={leftStyle}>{leftText}</PDFText>}\r\n {centerText && <PDFText style={centerStyle}>{centerText}</PDFText>}\r\n {rightText && <PDFText style={rightStyle}>{rightText}</PDFText>}\r\n </View>\r\n);\r\n\r\nexport const PageFooter = ({\r\n leftText,\r\n rightText,\r\n centerText,\r\n variant = \"simple\",\r\n background,\r\n textColor,\r\n marginTop,\r\n address,\r\n phone,\r\n email,\r\n website,\r\n fixed = false,\r\n sticky = false,\r\n pagePadding = 0,\r\n noWrap = true,\r\n style,\r\n}: PageFooterProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createPageFooterStyles(theme), [theme]);\r\n const _isFixed = fixed || sticky;\r\n const mt = sticky ? 0 : (marginTop ?? theme.spacing.sectionGap);\r\n const resolvedTextColor = textColor\r\n ? resolveColor(textColor, theme.colors)\r\n : undefined;\r\n // A footer passed as a render option lays out at full page width, so the\r\n // page padding has to come from the footer itself to line up with the content.\r\n const placement: Style = sticky\r\n ? {\r\n bottom: pagePadding,\r\n left: pagePadding,\r\n position: \"absolute\",\r\n right: pagePadding,\r\n }\r\n : { paddingLeft: pagePadding, paddingRight: pagePadding };\r\n\r\n const applyOverrides = (base: Style[]): Style[] => {\r\n if (background) {\r\n base.push({ backgroundColor: resolveColor(background, theme.colors) });\r\n }\r\n if (style) {\r\n base.push(style);\r\n }\r\n base.push(placement);\r\n return base;\r\n };\r\n\r\n const variantRenderers: Record<PageFooterVariant, () => React.ReactNode> = {\r\n branded: () =>\r\n renderBranded(\r\n styles,\r\n applyOverrides([styles.brandedContainer, { marginTop: mt }]),\r\n applyTextColor([styles.textBranded], resolvedTextColor),\r\n applyTextColor([styles.textBrandedRight], resolvedTextColor),\r\n leftText,\r\n rightText,\r\n noWrap\r\n ),\r\n centered: () =>\r\n renderCentered(\r\n styles,\r\n applyOverrides([styles.centeredContainer, { marginTop: mt }]),\r\n applyTextColor([styles.textCenteredVariant], resolvedTextColor),\r\n leftText,\r\n rightText,\r\n noWrap\r\n ),\r\n detailed: () =>\r\n renderDetailed(\r\n styles,\r\n applyOverrides([styles.detailedContainer, { marginTop: mt }]),\r\n applyTextColor([styles.companyBold], resolvedTextColor),\r\n applyTextColor([styles.textLeft], resolvedTextColor),\r\n applyTextColor([styles.textRight], resolvedTextColor),\r\n applyTextColor([styles.detailedPageNumber], resolvedTextColor),\r\n leftText,\r\n rightText,\r\n address,\r\n phone,\r\n email,\r\n website,\r\n noWrap\r\n ),\r\n minimal: () =>\r\n renderMinimal(\r\n styles,\r\n applyOverrides([styles.minimalContainer, { marginTop: mt }]),\r\n applyTextColor([styles.textLeft], resolvedTextColor),\r\n applyTextColor([styles.textRight], resolvedTextColor),\r\n leftText,\r\n rightText,\r\n noWrap\r\n ),\r\n simple: () =>\r\n renderSimple(\r\n styles,\r\n applyOverrides([styles.simpleContainer, { marginTop: mt }]),\r\n applyTextColor([styles.textLeft], resolvedTextColor),\r\n applyTextColor([styles.textCenter], resolvedTextColor),\r\n applyTextColor([styles.textRight], resolvedTextColor),\r\n leftText,\r\n centerText,\r\n rightText,\r\n noWrap\r\n ),\r\n \"three-column\": () =>\r\n renderThreeColumn(\r\n styles,\r\n applyOverrides([styles.threeColumnContainer, { marginTop: mt }]),\r\n applyTextColor([styles.companyName], resolvedTextColor),\r\n applyTextColor([styles.contactInfoCenter], resolvedTextColor),\r\n applyTextColor([styles.textRight], resolvedTextColor),\r\n leftText,\r\n rightText,\r\n address,\r\n phone,\r\n email,\r\n website,\r\n noWrap\r\n ),\r\n };\r\n\r\n return variantRenderers[variant]() as React.ReactNode;\r\n};\r\n",
+ "content": "import type { ReactNode } from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type PageFooterVariant =\n | \"simple\"\n | \"centered\"\n | \"branded\"\n | \"minimal\"\n | \"three-column\"\n | \"detailed\";\n\n/**\n * Footer row with layout variants, optional sticky or fixed positioning, and contact info support.\n * Props - `leftText` | `rightText` | `centerText` | `variant` | `background` | `textColor` | `marginTop` | `address` | `phone` | `email` | `website` | `fixed` | `sticky` | `pagePadding` | `noWrap` | `style`\n * @see {@link PageFooterProps}\n */\nexport interface PageFooterProps extends Omit<PDFComponentProps, \"children\"> {\n leftText?: ReactNode;\n rightText?: ReactNode;\n centerText?: ReactNode;\n /**\n * @default 'simple'\n */\n variant?: PageFooterVariant;\n background?: string;\n textColor?: string;\n marginTop?: number;\n address?: string;\n phone?: string;\n email?: string;\n website?: string;\n /**\n * @default false\n */\n fixed?: boolean;\n /**\n * @default false\n */\n sticky?: boolean;\n /**\n * @default 0\n */\n pagePadding?: number;\n /**\n * @default true\n */\n noWrap?: boolean;\n}\n\nconst createPageFooterStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights } = t.primitives;\n const c = t.colors;\n const { body } = t.typography;\n\n const textBase = {\n color: c.mutedForeground,\n fontFamily: body.fontFamily,\n fontSize: t.primitives.typography.xs,\n lineHeight: body.lineHeight,\n };\n\n return StyleSheet.create({\n brandedContainer: {\n alignItems: \"center\",\n backgroundColor: c.primary,\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingHorizontal: spacing[4],\n paddingVertical: spacing[3],\n },\n\n centeredContainer: {\n alignItems: \"center\",\n borderTopColor: c.border,\n borderTopStyle: \"solid\",\n borderTopWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"column\",\n paddingTop: spacing[3],\n },\n\n companyBold: {\n ...textBase,\n color: c.foreground,\n fontWeight: fontWeights.bold,\n },\n\n companyName: {\n ...textBase,\n color: c.foreground,\n fontWeight: fontWeights.medium,\n },\n\n contactInfoCenter: {\n ...textBase,\n fontSize: t.primitives.typography.xs - 1,\n marginTop: spacing[0.5],\n textAlign: \"center\",\n },\n detailedContainer: {\n borderTopColor: c.border,\n borderTopStyle: \"solid\",\n borderTopWidth: spacing[1],\n display: \"flex\",\n flexDirection: \"column\",\n paddingTop: spacing[3],\n },\n detailedLeft: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n detailedPageNumber: {\n ...textBase,\n borderTopColor: c.border,\n borderTopStyle: \"solid\",\n borderTopWidth: spacing[0.5],\n paddingTop: spacing[2],\n textAlign: \"center\",\n },\n detailedRight: {\n alignItems: \"flex-end\",\n display: \"flex\",\n flexDirection: \"column\",\n },\n detailedTopRow: {\n alignItems: \"flex-start\",\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: spacing[2],\n },\n\n minimalContainer: {\n alignItems: \"center\",\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: spacing[1],\n paddingTop: spacing[1],\n },\n simpleContainer: {\n alignItems: \"center\",\n borderTopColor: c.border,\n borderTopStyle: \"solid\",\n borderTopWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingTop: spacing[3],\n },\n textBranded: {\n ...textBase,\n color: c.primaryForeground,\n fontWeight: fontWeights.medium,\n },\n textBrandedRight: {\n ...textBase,\n color: c.primaryForeground,\n textAlign: \"right\",\n },\n textCenter: {\n ...textBase,\n flex: 1,\n textAlign: \"center\",\n },\n textCenteredVariant: {\n ...textBase,\n marginBottom: spacing[1],\n textAlign: \"center\",\n },\n\n textLeft: {\n ...textBase,\n flex: 1,\n },\n textRight: {\n ...textBase,\n textAlign: \"right\",\n },\n threeColumnCenter: {\n alignItems: \"center\",\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n threeColumnContainer: {\n alignItems: \"flex-start\",\n borderTopColor: c.border,\n borderTopStyle: \"solid\",\n borderTopWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingTop: spacing[3],\n },\n threeColumnLeft: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n threeColumnRight: {\n alignItems: \"flex-end\",\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n });\n};\n\ntype Styles = ReturnType<typeof createPageFooterStyles>;\n\nconst applyTextColor = (\n styles: Style[],\n color: string | undefined\n): Style[] => {\n if (!color) {\n return styles;\n }\n return [...styles, { color }];\n};\n\nconst renderBranded = (\n styles: Styles,\n containerStyles: Style[],\n leftStyle: Style[],\n rightStyle: Style[],\n leftText: ReactNode,\n rightText: ReactNode,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles}>\n {leftText && <PDFText style={leftStyle}>{leftText}</PDFText>}\n {rightText && <PDFText style={rightStyle}>{rightText}</PDFText>}\n </View>\n);\n\nconst renderCentered = (\n styles: Styles,\n containerStyles: Style[],\n textStyle: Style[],\n leftText: ReactNode,\n rightText: ReactNode,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles}>\n {leftText && <PDFText style={textStyle}>{leftText}</PDFText>}\n {rightText && <PDFText style={textStyle}>{rightText}</PDFText>}\n </View>\n);\n\nconst renderThreeColumn = (\n styles: Styles,\n containerStyles: Style[],\n leftStyle: Style[],\n centerStyle: Style[],\n rightStyle: Style[],\n leftText: ReactNode,\n rightText: ReactNode,\n address: string | undefined,\n phone: string | undefined,\n email: string | undefined,\n website: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles}>\n <View style={styles.threeColumnLeft}>\n {leftText && <PDFText style={leftStyle}>{leftText}</PDFText>}\n {address && <PDFText style={styles.textLeft}>{address}</PDFText>}\n </View>\n <View style={styles.threeColumnCenter}>\n {phone && <PDFText style={centerStyle}>{phone}</PDFText>}\n {email && <PDFText style={centerStyle}>{email}</PDFText>}\n {website && <PDFText style={centerStyle}>{website}</PDFText>}\n </View>\n <View style={styles.threeColumnRight}>\n {rightText && <PDFText style={rightStyle}>{rightText}</PDFText>}\n </View>\n </View>\n);\n\nconst renderDetailed = (\n styles: Styles,\n containerStyles: Style[],\n companyStyle: Style[],\n addrStyle: Style[],\n contactStyle: Style[],\n pageNumStyle: Style[],\n leftText: ReactNode,\n rightText: ReactNode,\n address: string | undefined,\n phone: string | undefined,\n email: string | undefined,\n website: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles}>\n <View style={styles.detailedTopRow}>\n <View style={styles.detailedLeft}>\n {leftText && <PDFText style={companyStyle}>{leftText}</PDFText>}\n {address && <PDFText style={addrStyle}>{address}</PDFText>}\n </View>\n <View style={styles.detailedRight}>\n {phone && <PDFText style={contactStyle}>{`Phone: ${phone}`}</PDFText>}\n {email && <PDFText style={contactStyle}>{`Email: ${email}`}</PDFText>}\n {website && <PDFText style={contactStyle}>{`Web: ${website}`}</PDFText>}\n </View>\n </View>\n {rightText && <PDFText style={pageNumStyle}>{rightText}</PDFText>}\n </View>\n);\n\nconst renderMinimal = (\n styles: Styles,\n containerStyles: Style[],\n leftStyle: Style[],\n rightStyle: Style[],\n leftText: ReactNode,\n rightText: ReactNode,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles}>\n {leftText && <PDFText style={leftStyle}>{leftText}</PDFText>}\n {rightText && <PDFText style={rightStyle}>{rightText}</PDFText>}\n </View>\n);\n\nconst renderSimple = (\n styles: Styles,\n containerStyles: Style[],\n leftStyle: Style[],\n centerStyle: Style[],\n rightStyle: Style[],\n leftText: ReactNode,\n centerText: ReactNode,\n rightText: ReactNode,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles}>\n {leftText && <PDFText style={leftStyle}>{leftText}</PDFText>}\n {centerText && <PDFText style={centerStyle}>{centerText}</PDFText>}\n {rightText && <PDFText style={rightStyle}>{rightText}</PDFText>}\n </View>\n);\n\nexport const PageFooter = ({\n leftText,\n rightText,\n centerText,\n variant = \"simple\",\n background,\n textColor,\n marginTop,\n address,\n phone,\n email,\n website,\n fixed = false,\n sticky = false,\n pagePadding = 0,\n noWrap = true,\n style,\n}: PageFooterProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createPageFooterStyles(theme), [theme]);\n const _isFixed = fixed || sticky;\n const mt = sticky ? 0 : (marginTop ?? theme.spacing.sectionGap);\n const resolvedTextColor = textColor\n ? resolveColor(textColor, theme.colors)\n : undefined;\n // A footer passed as a render option lays out at full page width, so the\n // page padding has to come from the footer itself to line up with the content.\n const placement: Style = sticky\n ? {\n bottom: pagePadding,\n left: pagePadding,\n position: \"absolute\",\n right: pagePadding,\n }\n : { paddingLeft: pagePadding, paddingRight: pagePadding };\n\n const applyOverrides = (base: Style[]): Style[] => {\n if (background) {\n base.push({ backgroundColor: resolveColor(background, theme.colors) });\n }\n if (style) {\n base.push(style);\n }\n base.push(placement);\n return base;\n };\n\n const variantRenderers: Record<PageFooterVariant, () => React.ReactNode> = {\n branded: () =>\n renderBranded(\n styles,\n applyOverrides([styles.brandedContainer, { marginTop: mt }]),\n applyTextColor([styles.textBranded], resolvedTextColor),\n applyTextColor([styles.textBrandedRight], resolvedTextColor),\n leftText,\n rightText,\n noWrap\n ),\n centered: () =>\n renderCentered(\n styles,\n applyOverrides([styles.centeredContainer, { marginTop: mt }]),\n applyTextColor([styles.textCenteredVariant], resolvedTextColor),\n leftText,\n rightText,\n noWrap\n ),\n detailed: () =>\n renderDetailed(\n styles,\n applyOverrides([styles.detailedContainer, { marginTop: mt }]),\n applyTextColor([styles.companyBold], resolvedTextColor),\n applyTextColor([styles.textLeft], resolvedTextColor),\n applyTextColor([styles.textRight], resolvedTextColor),\n applyTextColor([styles.detailedPageNumber], resolvedTextColor),\n leftText,\n rightText,\n address,\n phone,\n email,\n website,\n noWrap\n ),\n minimal: () =>\n renderMinimal(\n styles,\n applyOverrides([styles.minimalContainer, { marginTop: mt }]),\n applyTextColor([styles.textLeft], resolvedTextColor),\n applyTextColor([styles.textRight], resolvedTextColor),\n leftText,\n rightText,\n noWrap\n ),\n simple: () =>\n renderSimple(\n styles,\n applyOverrides([styles.simpleContainer, { marginTop: mt }]),\n applyTextColor([styles.textLeft], resolvedTextColor),\n applyTextColor([styles.textCenter], resolvedTextColor),\n applyTextColor([styles.textRight], resolvedTextColor),\n leftText,\n centerText,\n rightText,\n noWrap\n ),\n \"three-column\": () =>\n renderThreeColumn(\n styles,\n applyOverrides([styles.threeColumnContainer, { marginTop: mt }]),\n applyTextColor([styles.companyName], resolvedTextColor),\n applyTextColor([styles.contactInfoCenter], resolvedTextColor),\n applyTextColor([styles.textRight], resolvedTextColor),\n leftText,\n rightText,\n address,\n phone,\n email,\n website,\n noWrap\n ),\n };\n\n return variantRenderers[variant]() as React.ReactNode;\n};\n",
"type": "registry:component",
"target": "components/pdf/page-footer/page-footer.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/page-header.json b/apps/web/public/r/takumi/page-header.json
index 5af8250..3ac655c 100644
--- a/apps/web/public/r/takumi/page-header.json
+++ b/apps/web/public/r/takumi/page-header.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/takumi/components/page-header/page-header.tsx",
- "content": "import type { ReactNode } from \"react\";\r\n\r\nimport {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n Text as PDFText,\r\n StyleSheet,\r\n View,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type PageHeaderVariant =\r\n | \"simple\"\r\n | \"centered\"\r\n | \"minimal\"\r\n | \"branded\"\r\n | \"logo-left\"\r\n | \"logo-right\"\r\n | \"two-column\";\r\n\r\n/**\r\n * Header row with layout variants, logo support, and optional fixed positioning.\r\n * Props - `title` | `subtitle` | `rightText` | `rightSubText` | `variant` | `background` | `titleColor` | `marginBottom` | `address` | `phone` | `email` | `logo` | `fixed` | `noWrap` | `style`\r\n * @see {@link PageHeaderProps}\r\n */\r\nexport interface PageHeaderProps extends Omit<PDFComponentProps, \"children\"> {\r\n title: string;\r\n subtitle?: string;\r\n rightText?: string;\r\n rightSubText?: string;\r\n /**\r\n * @default 'simple'\r\n */\r\n variant?: PageHeaderVariant;\r\n background?: string;\r\n titleColor?: string;\r\n marginBottom?: number;\r\n address?: string;\r\n phone?: string;\r\n email?: string;\r\n logo?: ReactNode;\r\n /**\r\n * @default false\r\n */\r\n fixed?: boolean;\r\n /**\r\n * @default true\r\n */\r\n noWrap?: boolean;\r\n}\r\n\r\nconst createPageHeaderStyles = (t: PdfcnTheme) => {\r\n const { spacing, borderRadius, fontWeights } = t.primitives;\r\n const c = t.colors;\r\n const { heading, body } = t.typography;\r\n\r\n return StyleSheet.create({\r\n brandedContainer: {\r\n alignItems: \"center\",\r\n backgroundColor: c.primary,\r\n borderRadius: borderRadius.sm,\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n padding: spacing[6],\r\n },\r\n centeredContainer: {\r\n alignItems: \"center\",\r\n borderBottomColor: c.border,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: spacing[0.5],\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n paddingBottom: spacing[4],\r\n },\r\n contactInfo: {\r\n color: c.mutedForeground,\r\n fontFamily: body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n marginTop: spacing[0.5],\r\n textAlign: \"right\",\r\n },\r\n\r\n logoContainer: {\r\n height: 48,\r\n marginRight: spacing[4],\r\n width: 48,\r\n },\r\n\r\n logoContent: {\r\n display: \"flex\",\r\n flex: 1,\r\n flexDirection: \"column\",\r\n },\r\n logoLeftContainer: {\r\n alignItems: \"center\",\r\n borderBottomColor: c.border,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: spacing[0.5],\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n paddingBottom: spacing[4],\r\n },\r\n logoRightContainer: {\r\n alignItems: \"center\",\r\n borderBottomColor: c.border,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: spacing[0.5],\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n paddingBottom: spacing[4],\r\n },\r\n\r\n logoRightContent: {\r\n display: \"flex\",\r\n flex: 1,\r\n flexDirection: \"column\",\r\n },\r\n\r\n logoRightLogoContainer: {\r\n height: 48,\r\n marginLeft: spacing[4],\r\n width: 48,\r\n },\r\n minimalContainer: {\r\n alignItems: \"center\",\r\n borderBottomColor: c.primary,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: spacing[1],\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n paddingBottom: spacing[3],\r\n },\r\n minimalLeft: {\r\n flex: 1,\r\n },\r\n minimalRight: {\r\n alignItems: \"flex-end\",\r\n },\r\n\r\n rightSubText: {\r\n color: c.mutedForeground,\r\n fontFamily: body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n marginTop: spacing[1],\r\n textAlign: \"right\",\r\n },\r\n rightText: {\r\n color: c.foreground,\r\n fontFamily: body.fontFamily,\r\n fontSize: body.fontSize,\r\n fontWeight: fontWeights.medium,\r\n textAlign: \"right\",\r\n },\r\n simpleContainer: {\r\n alignItems: \"flex-start\",\r\n borderBottomColor: c.border,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: spacing[0.5],\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n paddingBottom: spacing[4],\r\n },\r\n\r\n simpleLeft: {\r\n display: \"flex\",\r\n flex: 1,\r\n flexDirection: \"column\",\r\n },\r\n simpleRight: {\r\n alignItems: \"flex-end\",\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n },\r\n\r\n subtitle: {\r\n color: c.mutedForeground,\r\n fontFamily: body.fontFamily,\r\n fontSize: body.fontSize,\r\n lineHeight: body.lineHeight,\r\n marginTop: spacing[1],\r\n },\r\n subtitleBranded: {\r\n color: c.primaryForeground,\r\n marginTop: spacing[1],\r\n },\r\n subtitleCentered: {\r\n textAlign: \"center\",\r\n },\r\n\r\n title: {\r\n color: c.foreground,\r\n fontFamily: heading.fontFamily,\r\n fontSize: heading.fontSize.h3,\r\n fontWeight: fontWeights.bold,\r\n lineHeight: heading.lineHeight,\r\n marginBottom: 0,\r\n },\r\n titleBranded: {\r\n color: c.primaryForeground,\r\n },\r\n titleCentered: {\r\n textAlign: \"center\",\r\n },\r\n\r\n titleMinimal: {\r\n fontSize: heading.fontSize.h3,\r\n fontWeight: fontWeights.bold,\r\n },\r\n twoColumnContainer: {\r\n alignItems: \"flex-start\",\r\n borderBottomColor: c.border,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: spacing[0.5],\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n paddingBottom: spacing[4],\r\n },\r\n twoColumnLeft: {\r\n display: \"flex\",\r\n flex: 1,\r\n flexDirection: \"column\",\r\n },\r\n twoColumnRight: {\r\n alignItems: \"flex-end\",\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n },\r\n });\r\n};\r\n\r\ntype Styles = ReturnType<typeof createPageHeaderStyles>;\r\n\r\nconst buildContainerStyles = (\r\n base: Style,\r\n mb: number,\r\n background: string | undefined,\r\n theme: PdfcnTheme,\r\n style: Style | undefined,\r\n ...extras: Style[]\r\n): Style[] => {\r\n const result: Style[] = [base, { marginBottom: mb }, ...extras];\r\n if (background) {\r\n result.push({ backgroundColor: resolveColor(background, theme.colors) });\r\n }\r\n if (style) {\r\n result.push(style);\r\n }\r\n return result;\r\n};\r\n\r\nconst buildTitleStyles = (\r\n base: Style[],\r\n titleColor: string | undefined,\r\n theme: PdfcnTheme\r\n): Style[] => {\r\n if (!titleColor) {\r\n return base;\r\n }\r\n return [...base, { color: resolveColor(titleColor, theme.colors) }];\r\n};\r\n\r\nconst renderBranded = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n titleStyles: Style[],\r\n title: string,\r\n subtitle: string | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles}>\r\n <PDFText style={titleStyles}>{title}</PDFText>\r\n {subtitle && (\r\n <PDFText style={[styles.subtitle, styles.subtitleBranded]}>\r\n {subtitle}\r\n </PDFText>\r\n )}\r\n </View>\r\n);\r\n\r\nconst renderCentered = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n titleStyles: Style[],\r\n title: string,\r\n subtitle: string | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles}>\r\n <PDFText style={titleStyles}>{title}</PDFText>\r\n {subtitle && (\r\n <PDFText style={[styles.subtitle, styles.subtitleCentered]}>\r\n {subtitle}\r\n </PDFText>\r\n )}\r\n </View>\r\n);\r\n\r\nconst renderLogoRight = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n titleStyles: Style[],\r\n title: string,\r\n subtitle: string | undefined,\r\n logo: ReactNode | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles}>\r\n <View style={styles.logoRightContent}>\r\n <PDFText style={titleStyles}>{title}</PDFText>\r\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\r\n </View>\r\n {logo && <View style={styles.logoRightLogoContainer}>{logo}</View>}\r\n </View>\r\n);\r\n\r\nconst renderLogoLeft = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n titleStyles: Style[],\r\n title: string,\r\n subtitle: string | undefined,\r\n logo: ReactNode | undefined,\r\n rightText: string | undefined,\r\n rightSubText: string | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles}>\r\n {logo && <View style={styles.logoContainer}>{logo}</View>}\r\n <View style={styles.logoContent}>\r\n <PDFText style={titleStyles}>{title}</PDFText>\r\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\r\n </View>\r\n {(rightText || rightSubText) && (\r\n <View style={styles.simpleRight}>\r\n {rightText && <PDFText style={styles.rightText}>{rightText}</PDFText>}\r\n {rightSubText && (\r\n <PDFText style={styles.rightSubText}>{rightSubText}</PDFText>\r\n )}\r\n </View>\r\n )}\r\n </View>\r\n);\r\n\r\nconst renderTwoColumn = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n titleStyles: Style[],\r\n title: string,\r\n subtitle: string | undefined,\r\n address: string | undefined,\r\n phone: string | undefined,\r\n email: string | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles}>\r\n <View style={styles.twoColumnLeft}>\r\n <PDFText style={titleStyles}>{title}</PDFText>\r\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\r\n </View>\r\n {(address || phone || email) && (\r\n <View style={styles.twoColumnRight}>\r\n {address && <PDFText style={styles.contactInfo}>{address}</PDFText>}\r\n {phone && <PDFText style={styles.contactInfo}>{phone}</PDFText>}\r\n {email && <PDFText style={styles.contactInfo}>{email}</PDFText>}\r\n </View>\r\n )}\r\n </View>\r\n);\r\n\r\nconst renderMinimal = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n titleStyles: Style[],\r\n title: string,\r\n subtitle: string | undefined,\r\n rightText: string | undefined,\r\n rightSubText: string | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles}>\r\n <View style={styles.minimalLeft}>\r\n <PDFText style={titleStyles}>{title}</PDFText>\r\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\r\n </View>\r\n {(rightText || rightSubText) && (\r\n <View style={styles.minimalRight}>\r\n {rightText && <PDFText style={styles.rightText}>{rightText}</PDFText>}\r\n {rightSubText && (\r\n <PDFText style={styles.rightSubText}>{rightSubText}</PDFText>\r\n )}\r\n </View>\r\n )}\r\n </View>\r\n);\r\n\r\nconst renderSimple = (\r\n styles: Styles,\r\n containerStyles: Style[],\r\n titleStyles: Style[],\r\n title: string,\r\n subtitle: string | undefined,\r\n rightText: string | undefined,\r\n rightSubText: string | undefined,\r\n noWrap: boolean\r\n) => (\r\n <View wrap={!noWrap} style={containerStyles}>\r\n <View style={styles.simpleLeft}>\r\n <PDFText style={titleStyles}>{title}</PDFText>\r\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\r\n </View>\r\n {(rightText || rightSubText) && (\r\n <View style={styles.simpleRight}>\r\n {rightText && <PDFText style={styles.rightText}>{rightText}</PDFText>}\r\n {rightSubText && (\r\n <PDFText style={styles.rightSubText}>{rightSubText}</PDFText>\r\n )}\r\n </View>\r\n )}\r\n </View>\r\n);\r\n\r\nexport const PageHeader = ({\r\n title,\r\n subtitle,\r\n rightText,\r\n rightSubText,\r\n variant = \"simple\",\r\n background,\r\n titleColor,\r\n marginBottom,\r\n logo,\r\n address,\r\n phone,\r\n email,\r\n noWrap = true,\r\n style,\r\n}: PageHeaderProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createPageHeaderStyles(theme), [theme]);\r\n const mb = marginBottom ?? theme.spacing.sectionGap;\r\n\r\n const variantRenderers: Record<PageHeaderVariant, () => React.ReactNode> = {\r\n branded: () =>\r\n renderBranded(\r\n styles,\r\n buildContainerStyles(\r\n styles.brandedContainer,\r\n mb,\r\n background,\r\n theme,\r\n style\r\n ),\r\n buildTitleStyles(\r\n [styles.title, styles.titleBranded, styles.titleCentered],\r\n titleColor,\r\n theme\r\n ),\r\n title,\r\n subtitle,\r\n noWrap\r\n ),\r\n centered: () =>\r\n renderCentered(\r\n styles,\r\n buildContainerStyles(\r\n styles.centeredContainer,\r\n mb,\r\n background,\r\n theme,\r\n style\r\n ),\r\n buildTitleStyles(\r\n [styles.title, styles.titleCentered],\r\n titleColor,\r\n theme\r\n ),\r\n title,\r\n subtitle,\r\n noWrap\r\n ),\r\n \"logo-left\": () =>\r\n renderLogoLeft(\r\n styles,\r\n buildContainerStyles(\r\n styles.logoLeftContainer,\r\n mb,\r\n background,\r\n theme,\r\n style\r\n ),\r\n buildTitleStyles([styles.title], titleColor, theme),\r\n title,\r\n subtitle,\r\n logo,\r\n rightText,\r\n rightSubText,\r\n noWrap\r\n ),\r\n \"logo-right\": () =>\r\n renderLogoRight(\r\n styles,\r\n buildContainerStyles(\r\n styles.logoRightContainer,\r\n mb,\r\n background,\r\n theme,\r\n style\r\n ),\r\n buildTitleStyles([styles.title], titleColor, theme),\r\n title,\r\n subtitle,\r\n logo,\r\n noWrap\r\n ),\r\n minimal: () =>\r\n renderMinimal(\r\n styles,\r\n buildContainerStyles(\r\n styles.minimalContainer,\r\n mb,\r\n background,\r\n theme,\r\n style\r\n ),\r\n buildTitleStyles(\r\n [styles.title, styles.titleMinimal],\r\n titleColor,\r\n theme\r\n ),\r\n title,\r\n subtitle,\r\n rightText,\r\n rightSubText,\r\n noWrap\r\n ),\r\n simple: () =>\r\n renderSimple(\r\n styles,\r\n buildContainerStyles(\r\n styles.simpleContainer,\r\n mb,\r\n background,\r\n theme,\r\n style\r\n ),\r\n buildTitleStyles([styles.title], titleColor, theme),\r\n title,\r\n subtitle,\r\n rightText,\r\n rightSubText,\r\n noWrap\r\n ),\r\n \"two-column\": () =>\r\n renderTwoColumn(\r\n styles,\r\n buildContainerStyles(\r\n styles.twoColumnContainer,\r\n mb,\r\n background,\r\n theme,\r\n style\r\n ),\r\n buildTitleStyles([styles.title], titleColor, theme),\r\n title,\r\n subtitle,\r\n address,\r\n phone,\r\n email,\r\n noWrap\r\n ),\r\n };\r\n\r\n return variantRenderers[variant]() as React.ReactNode;\r\n};\r\n",
+ "content": "import type { ReactNode } from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type PageHeaderVariant =\n | \"simple\"\n | \"centered\"\n | \"minimal\"\n | \"branded\"\n | \"logo-left\"\n | \"logo-right\"\n | \"two-column\";\n\n/**\n * Header row with layout variants, logo support, and optional fixed positioning.\n * Props - `title` | `subtitle` | `rightText` | `rightSubText` | `variant` | `background` | `titleColor` | `marginBottom` | `address` | `phone` | `email` | `logo` | `fixed` | `noWrap` | `style`\n * @see {@link PageHeaderProps}\n */\nexport interface PageHeaderProps extends Omit<PDFComponentProps, \"children\"> {\n title: string;\n subtitle?: string;\n rightText?: string;\n rightSubText?: string;\n /**\n * @default 'simple'\n */\n variant?: PageHeaderVariant;\n background?: string;\n titleColor?: string;\n marginBottom?: number;\n address?: string;\n phone?: string;\n email?: string;\n logo?: ReactNode;\n /**\n * @default false\n */\n fixed?: boolean;\n /**\n * @default true\n */\n noWrap?: boolean;\n}\n\nconst createPageHeaderStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius, fontWeights } = t.primitives;\n const c = t.colors;\n const { heading, body } = t.typography;\n\n return StyleSheet.create({\n brandedContainer: {\n alignItems: \"center\",\n backgroundColor: c.primary,\n borderRadius: borderRadius.sm,\n display: \"flex\",\n flexDirection: \"column\",\n padding: spacing[6],\n },\n centeredContainer: {\n alignItems: \"center\",\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"column\",\n paddingBottom: spacing[4],\n },\n contactInfo: {\n color: c.mutedForeground,\n fontFamily: body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginTop: spacing[0.5],\n textAlign: \"right\",\n },\n\n logoContainer: {\n height: 48,\n marginRight: spacing[4],\n width: 48,\n },\n\n logoContent: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n logoLeftContainer: {\n alignItems: \"center\",\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n paddingBottom: spacing[4],\n },\n logoRightContainer: {\n alignItems: \"center\",\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: spacing[4],\n },\n\n logoRightContent: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n\n logoRightLogoContainer: {\n height: 48,\n marginLeft: spacing[4],\n width: 48,\n },\n minimalContainer: {\n alignItems: \"center\",\n borderBottomColor: c.primary,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[1],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: spacing[3],\n },\n minimalLeft: {\n flex: 1,\n },\n minimalRight: {\n alignItems: \"flex-end\",\n },\n\n rightSubText: {\n color: c.mutedForeground,\n fontFamily: body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginTop: spacing[1],\n textAlign: \"right\",\n },\n rightText: {\n color: c.foreground,\n fontFamily: body.fontFamily,\n fontSize: body.fontSize,\n fontWeight: fontWeights.medium,\n textAlign: \"right\",\n },\n simpleContainer: {\n alignItems: \"flex-start\",\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: spacing[4],\n },\n\n simpleLeft: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n simpleRight: {\n alignItems: \"flex-end\",\n display: \"flex\",\n flexDirection: \"column\",\n },\n\n subtitle: {\n color: c.mutedForeground,\n fontFamily: body.fontFamily,\n fontSize: body.fontSize,\n lineHeight: body.lineHeight,\n marginTop: spacing[1],\n },\n subtitleBranded: {\n color: c.primaryForeground,\n marginTop: spacing[1],\n },\n subtitleCentered: {\n textAlign: \"center\",\n },\n\n title: {\n color: c.foreground,\n fontFamily: heading.fontFamily,\n fontSize: heading.fontSize.h3,\n fontWeight: fontWeights.bold,\n lineHeight: heading.lineHeight,\n marginBottom: 0,\n },\n titleBranded: {\n color: c.primaryForeground,\n },\n titleCentered: {\n textAlign: \"center\",\n },\n\n titleMinimal: {\n fontSize: heading.fontSize.h3,\n fontWeight: fontWeights.bold,\n },\n twoColumnContainer: {\n alignItems: \"flex-start\",\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: spacing[4],\n },\n twoColumnLeft: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n twoColumnRight: {\n alignItems: \"flex-end\",\n display: \"flex\",\n flexDirection: \"column\",\n },\n });\n};\n\ntype Styles = ReturnType<typeof createPageHeaderStyles>;\n\nconst buildContainerStyles = (\n base: Style,\n mb: number,\n background: string | undefined,\n theme: PdfcnTheme,\n style: Style | undefined,\n ...extras: Style[]\n): Style[] => {\n const result: Style[] = [base, { marginBottom: mb }, ...extras];\n if (background) {\n result.push({ backgroundColor: resolveColor(background, theme.colors) });\n }\n if (style) {\n result.push(style);\n }\n return result;\n};\n\nconst buildTitleStyles = (\n base: Style[],\n titleColor: string | undefined,\n theme: PdfcnTheme\n): Style[] => {\n if (!titleColor) {\n return base;\n }\n return [...base, { color: resolveColor(titleColor, theme.colors) }];\n};\n\nconst renderBranded = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles}>\n <PDFText style={titleStyles}>{title}</PDFText>\n {subtitle && (\n <PDFText style={[styles.subtitle, styles.subtitleBranded]}>\n {subtitle}\n </PDFText>\n )}\n </View>\n);\n\nconst renderCentered = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles}>\n <PDFText style={titleStyles}>{title}</PDFText>\n {subtitle && (\n <PDFText style={[styles.subtitle, styles.subtitleCentered]}>\n {subtitle}\n </PDFText>\n )}\n </View>\n);\n\nconst renderLogoRight = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n logo: ReactNode | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles}>\n <View style={styles.logoRightContent}>\n <PDFText style={titleStyles}>{title}</PDFText>\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n </View>\n {logo && <View style={styles.logoRightLogoContainer}>{logo}</View>}\n </View>\n);\n\nconst renderLogoLeft = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n logo: ReactNode | undefined,\n rightText: string | undefined,\n rightSubText: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles}>\n {logo && <View style={styles.logoContainer}>{logo}</View>}\n <View style={styles.logoContent}>\n <PDFText style={titleStyles}>{title}</PDFText>\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n </View>\n {(rightText || rightSubText) && (\n <View style={styles.simpleRight}>\n {rightText && <PDFText style={styles.rightText}>{rightText}</PDFText>}\n {rightSubText && (\n <PDFText style={styles.rightSubText}>{rightSubText}</PDFText>\n )}\n </View>\n )}\n </View>\n);\n\nconst renderTwoColumn = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n address: string | undefined,\n phone: string | undefined,\n email: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles}>\n <View style={styles.twoColumnLeft}>\n <PDFText style={titleStyles}>{title}</PDFText>\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n </View>\n {(address || phone || email) && (\n <View style={styles.twoColumnRight}>\n {address && <PDFText style={styles.contactInfo}>{address}</PDFText>}\n {phone && <PDFText style={styles.contactInfo}>{phone}</PDFText>}\n {email && <PDFText style={styles.contactInfo}>{email}</PDFText>}\n </View>\n )}\n </View>\n);\n\nconst renderMinimal = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n rightText: string | undefined,\n rightSubText: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles}>\n <View style={styles.minimalLeft}>\n <PDFText style={titleStyles}>{title}</PDFText>\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n </View>\n {(rightText || rightSubText) && (\n <View style={styles.minimalRight}>\n {rightText && <PDFText style={styles.rightText}>{rightText}</PDFText>}\n {rightSubText && (\n <PDFText style={styles.rightSubText}>{rightSubText}</PDFText>\n )}\n </View>\n )}\n </View>\n);\n\nconst renderSimple = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n rightText: string | undefined,\n rightSubText: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles}>\n <View style={styles.simpleLeft}>\n <PDFText style={titleStyles}>{title}</PDFText>\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n </View>\n {(rightText || rightSubText) && (\n <View style={styles.simpleRight}>\n {rightText && <PDFText style={styles.rightText}>{rightText}</PDFText>}\n {rightSubText && (\n <PDFText style={styles.rightSubText}>{rightSubText}</PDFText>\n )}\n </View>\n )}\n </View>\n);\n\nexport const PageHeader = ({\n title,\n subtitle,\n rightText,\n rightSubText,\n variant = \"simple\",\n background,\n titleColor,\n marginBottom,\n logo,\n address,\n phone,\n email,\n noWrap = true,\n style,\n}: PageHeaderProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createPageHeaderStyles(theme), [theme]);\n const mb = marginBottom ?? theme.spacing.sectionGap;\n\n const variantRenderers: Record<PageHeaderVariant, () => React.ReactNode> = {\n branded: () =>\n renderBranded(\n styles,\n buildContainerStyles(\n styles.brandedContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles(\n [styles.title, styles.titleBranded, styles.titleCentered],\n titleColor,\n theme\n ),\n title,\n subtitle,\n noWrap\n ),\n centered: () =>\n renderCentered(\n styles,\n buildContainerStyles(\n styles.centeredContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles(\n [styles.title, styles.titleCentered],\n titleColor,\n theme\n ),\n title,\n subtitle,\n noWrap\n ),\n \"logo-left\": () =>\n renderLogoLeft(\n styles,\n buildContainerStyles(\n styles.logoLeftContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles([styles.title], titleColor, theme),\n title,\n subtitle,\n logo,\n rightText,\n rightSubText,\n noWrap\n ),\n \"logo-right\": () =>\n renderLogoRight(\n styles,\n buildContainerStyles(\n styles.logoRightContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles([styles.title], titleColor, theme),\n title,\n subtitle,\n logo,\n noWrap\n ),\n minimal: () =>\n renderMinimal(\n styles,\n buildContainerStyles(\n styles.minimalContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles(\n [styles.title, styles.titleMinimal],\n titleColor,\n theme\n ),\n title,\n subtitle,\n rightText,\n rightSubText,\n noWrap\n ),\n simple: () =>\n renderSimple(\n styles,\n buildContainerStyles(\n styles.simpleContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles([styles.title], titleColor, theme),\n title,\n subtitle,\n rightText,\n rightSubText,\n noWrap\n ),\n \"two-column\": () =>\n renderTwoColumn(\n styles,\n buildContainerStyles(\n styles.twoColumnContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles([styles.title], titleColor, theme),\n title,\n subtitle,\n address,\n phone,\n email,\n noWrap\n ),\n };\n\n return variantRenderers[variant]() as React.ReactNode;\n};\n",
"type": "registry:component",
"target": "components/pdf/page-header/page-header.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/page-number.json b/apps/web/public/r/takumi/page-number.json
index 82a2001..03141f9 100644
--- a/apps/web/public/r/takumi/page-number.json
+++ b/apps/web/public/r/takumi/page-number.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/takumi/components/page-number/page-number.tsx",
- "content": "import {\r\n PageNumber as PageNumberPrimitive,\r\n TotalPages as TotalPagesPrimitive,\r\n} from \"takumi-pdf/primitives\";\r\n\r\nimport {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n Text as PDFText,\r\n StyleSheet,\r\n flatten,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type PageNumberAlign = \"left\" | \"center\" | \"right\";\r\nexport type PageNumberSize = \"xs\" | \"sm\" | \"md\";\r\n\r\n/**\r\n * Auto page number rendered with a configurable format string at a or inline position.\r\n * Props - `format` | `align` | `size` | `fixed` | `muted` | `style`\r\n * @see {@link PageNumberProps}\r\n */\r\nexport interface PageNumberProps extends Omit<PDFComponentProps, \"children\"> {\r\n /**\r\n * Format string — use `{page}` for current page and `{total}` for total page count.\r\n * @default 'Page {page} of {total}'\r\n */\r\n format?: string;\r\n /**\r\n * @default 'center'\r\n */\r\n align?: PageNumberAlign;\r\n /**\r\n * @default 'sm'\r\n */\r\n size?: PageNumberSize;\r\n /**\r\n * @default false\r\n */\r\n fixed?: boolean;\r\n /**\r\n * @default true\r\n */\r\n muted?: boolean;\r\n children?: never;\r\n}\r\n\r\nconst createPageNumberStyles = (t: PdfcnTheme) => {\r\n const { typography, colors, primitives } = t;\r\n return StyleSheet.create({\r\n alignCenter: { textAlign: \"center\" },\r\n alignLeft: { textAlign: \"left\" },\r\n alignRight: { textAlign: \"right\" },\r\n colorForeground: { color: colors.foreground },\r\n colorMuted: { color: colors.mutedForeground },\r\n container: {\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n width: \"100%\",\r\n },\r\n justifyCenter: { justifyContent: \"center\" },\r\n justifyLeft: { justifyContent: \"flex-start\" },\r\n justifyRight: { justifyContent: \"flex-end\" },\r\n sizeMd: { fontSize: primitives.typography.base },\r\n sizeSm: { fontSize: primitives.typography.sm },\r\n sizeXs: { fontSize: primitives.typography.xs },\r\n text: { fontFamily: typography.body.fontFamily },\r\n });\r\n};\r\n\r\nexport const PageNumber = ({\r\n format = \"Page {page} of {total}\",\r\n align = \"center\",\r\n size = \"sm\",\r\n muted = true,\r\n style,\r\n}: PageNumberProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createPageNumberStyles(theme), [theme]);\r\n const alignMap = {\r\n center: styles.alignCenter,\r\n left: styles.alignLeft,\r\n right: styles.alignRight,\r\n } as Record<PageNumberAlign, Style>;\r\n const sizeMap = {\r\n md: styles.sizeMd,\r\n sm: styles.sizeSm,\r\n xs: styles.sizeXs,\r\n } as Record<PageNumberSize, Style>;\r\n const justifyMap = {\r\n center: styles.justifyCenter,\r\n left: styles.justifyLeft,\r\n right: styles.justifyRight,\r\n } as Record<PageNumberAlign, Style>;\r\n const textStyles: Style[] = [\r\n styles.text,\r\n alignMap[align],\r\n sizeMap[size],\r\n muted ? styles.colorMuted : styles.colorForeground,\r\n ];\r\n if (style) {\r\n textStyles.push(...[style].flat());\r\n }\r\n return (\r\n <View style={[styles.container, justifyMap[align]]}>\r\n {format.split(/({page}|{total})/).map((part, index) => {\r\n if (part === \"{page}\") {\r\n return (\r\n <PageNumberPrimitive\r\n key={`page-${index}`}\r\n style={flatten(textStyles)}\r\n />\r\n );\r\n }\r\n if (part === \"{total}\") {\r\n return (\r\n <TotalPagesPrimitive\r\n key={`total-${index}`}\r\n style={flatten(textStyles)}\r\n />\r\n );\r\n }\r\n return (\r\n <PDFText key={`text-${index}`} style={textStyles}>\r\n {part}\r\n </PDFText>\r\n );\r\n })}\r\n </View>\r\n );\r\n};\r\n",
+ "content": "import {\n PageNumber as PageNumberPrimitive,\n TotalPages as TotalPagesPrimitive,\n} from \"takumi-pdf/primitives\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n flatten,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type PageNumberAlign = \"left\" | \"center\" | \"right\";\nexport type PageNumberSize = \"xs\" | \"sm\" | \"md\";\n\n/**\n * Auto page number rendered with a configurable format string at a or inline position.\n * Props - `format` | `align` | `size` | `fixed` | `muted` | `style`\n * @see {@link PageNumberProps}\n */\nexport interface PageNumberProps extends Omit<PDFComponentProps, \"children\"> {\n /**\n * Format string — use `{page}` for current page and `{total}` for total page count.\n * @default 'Page {page} of {total}'\n */\n format?: string;\n /**\n * @default 'center'\n */\n align?: PageNumberAlign;\n /**\n * @default 'sm'\n */\n size?: PageNumberSize;\n /**\n * @default false\n */\n fixed?: boolean;\n /**\n * @default true\n */\n muted?: boolean;\n children?: never;\n}\n\nconst createPageNumberStyles = (t: PdfcnTheme) => {\n const { typography, colors, primitives } = t;\n return StyleSheet.create({\n alignCenter: { textAlign: \"center\" },\n alignLeft: { textAlign: \"left\" },\n alignRight: { textAlign: \"right\" },\n colorForeground: { color: colors.foreground },\n colorMuted: { color: colors.mutedForeground },\n container: {\n display: \"flex\",\n flexDirection: \"row\",\n width: \"100%\",\n },\n justifyCenter: { justifyContent: \"center\" },\n justifyLeft: { justifyContent: \"flex-start\" },\n justifyRight: { justifyContent: \"flex-end\" },\n sizeMd: { fontSize: primitives.typography.base },\n sizeSm: { fontSize: primitives.typography.sm },\n sizeXs: { fontSize: primitives.typography.xs },\n text: { fontFamily: typography.body.fontFamily },\n });\n};\n\nexport const PageNumber = ({\n format = \"Page {page} of {total}\",\n align = \"center\",\n size = \"sm\",\n muted = true,\n style,\n}: PageNumberProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createPageNumberStyles(theme), [theme]);\n const alignMap = {\n center: styles.alignCenter,\n left: styles.alignLeft,\n right: styles.alignRight,\n } as Record<PageNumberAlign, Style>;\n const sizeMap = {\n md: styles.sizeMd,\n sm: styles.sizeSm,\n xs: styles.sizeXs,\n } as Record<PageNumberSize, Style>;\n const justifyMap = {\n center: styles.justifyCenter,\n left: styles.justifyLeft,\n right: styles.justifyRight,\n } as Record<PageNumberAlign, Style>;\n const textStyles: Style[] = [\n styles.text,\n alignMap[align],\n sizeMap[size],\n muted ? styles.colorMuted : styles.colorForeground,\n ];\n if (style) {\n textStyles.push(...[style].flat());\n }\n return (\n <View style={[styles.container, justifyMap[align]]}>\n {format.split(/({page}|{total})/).map((part, index) => {\n if (part === \"{page}\") {\n return (\n <PageNumberPrimitive\n key={`page-${index}`}\n style={flatten(textStyles)}\n />\n );\n }\n if (part === \"{total}\") {\n return (\n <TotalPagesPrimitive\n key={`total-${index}`}\n style={flatten(textStyles)}\n />\n );\n }\n return (\n <PDFText key={`text-${index}`} style={textStyles}>\n {part}\n </PDFText>\n );\n })}\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/page-number/page-number.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/pdf-image.json b/apps/web/public/r/takumi/pdf-image.json
index 025e756..1d3691c 100644
--- a/apps/web/public/r/takumi/pdf-image.json
+++ b/apps/web/public/r/takumi/pdf-image.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/takumi/components/pdf-image/pdf-image.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n Text as PDFText,\r\n StyleSheet,\r\n Image,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\n/** HTTP method used when fetching the image from a URL. */\r\nexport type PdfImageHTTPMethod =\r\n | \"GET\"\r\n | \"HEAD\"\r\n | \"POST\"\r\n | \"PUT\"\r\n | \"DELETE\"\r\n | \"PATCH\";\r\n\r\nexport type PdfImageSrc =\r\n | string\r\n | {\r\n uri: string;\r\n method?: PdfImageHTTPMethod;\r\n headers?: Record<string, string>;\r\n body?: string;\r\n };\r\n\r\nexport type PdfImageFit = \"cover\" | \"contain\" | \"fill\" | \"none\";\r\n\r\nexport type PdfImageVariant =\r\n | \"default\"\r\n | \"full-width\"\r\n | \"thumbnail\"\r\n | \"avatar\"\r\n | \"cover\"\r\n | \"bordered\"\r\n | \"rounded\";\r\n\r\n/**\r\n * Image element with layout presets, caption, and aspect ratio support.\r\n * Props - `src` | `variant` | `width` | `height` | `fit` | `position` | `caption` | `aspectRatio` | `borderRadius` | `noWrap` | `style`\r\n * @see {@link PdfImageProps}\r\n */\r\nexport interface PdfImageProps {\r\n src: PdfImageSrc;\r\n /**\r\n * @default 'default'\r\n */\r\n variant?: PdfImageVariant;\r\n width?: number | string;\r\n height?: number | string;\r\n fit?: PdfImageFit;\r\n /**\r\n * @default '50% 50%'\r\n */\r\n position?: string;\r\n caption?: string;\r\n aspectRatio?: number;\r\n borderRadius?: number;\r\n /**\r\n * @default true\r\n */\r\n noWrap?: boolean;\r\n style?: Style;\r\n}\r\n\r\ninterface VariantDefaults {\r\n width?: number | string;\r\n height?: number | string;\r\n fit: PdfImageFit;\r\n borderRadius?: number;\r\n}\r\n\r\nconst VARIANT_DEFAULTS: Record<PdfImageVariant, VariantDefaults> = {\r\n avatar: { borderRadius: 999, fit: \"cover\", height: 48, width: 48 },\r\n bordered: { fit: \"contain\", width: \"100%\" },\r\n cover: { fit: \"cover\", height: 160, width: \"100%\" },\r\n default: { fit: \"contain\" },\r\n \"full-width\": { fit: \"cover\", width: \"100%\" },\r\n rounded: { borderRadius: 8, fit: \"contain\", width: 200 },\r\n thumbnail: { fit: \"cover\", height: 80, width: 80 },\r\n};\r\n\r\nconst UNSUPPORTED_FORMATS = new Set([\"webp\", \"avif\", \"heic\", \"heif\", \"ico\"]);\r\n\r\nconst detectFormat = (src: PdfImageSrc): string | null => {\r\n if (typeof src !== \"string\") {\r\n return null;\r\n }\r\n const dataMatch = src.match(/^data:image\\/([a-zA-Z0-9+.-]+)/);\r\n if (dataMatch) {\r\n return dataMatch[1].toLowerCase();\r\n }\r\n return src.split(\"?\")[0].split(\".\").pop()?.toLowerCase() ?? null;\r\n};\r\n\r\nconst warnIfUnsupported = (src: PdfImageSrc): void => {\r\n const fmt = detectFormat(src);\r\n if (fmt && UNSUPPORTED_FORMATS.has(fmt)) {\r\n console.warn(\r\n `[PdfImage] Unsupported format \"${fmt}\" detected. react-pdf supports: JPEG, PNG, GIF (first frame), BMP, SVG. Convert to PNG or JPEG before use.`\r\n );\r\n }\r\n};\r\n\r\nconst createImageStyles = (t: PdfcnTheme) => {\r\n const { spacing } = t.primitives;\r\n return StyleSheet.create({\r\n caption: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n marginTop: spacing[1],\r\n textAlign: \"center\",\r\n },\r\n container: { flexDirection: \"column\" },\r\n image: {},\r\n imageBordered: {\r\n borderColor: t.colors.border,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n },\r\n });\r\n};\r\n\r\nexport const PdfImage = ({\r\n src,\r\n variant = \"default\",\r\n width,\r\n height,\r\n fit,\r\n position = \"50% 50%\",\r\n caption,\r\n aspectRatio,\r\n borderRadius,\r\n noWrap = true,\r\n style,\r\n}: PdfImageProps) => {\r\n warnIfUnsupported(src);\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createImageStyles(theme), [theme]);\r\n const defaults = VARIANT_DEFAULTS[variant];\r\n\r\n const resolvedWidth = width ?? defaults.width;\r\n const resolvedHeight: number | string | undefined = (() => {\r\n if (height !== undefined) {\r\n return height;\r\n }\r\n if (defaults.height !== undefined) {\r\n return defaults.height;\r\n }\r\n if (aspectRatio !== undefined && typeof resolvedWidth === \"number\") {\r\n return resolvedWidth / aspectRatio;\r\n }\r\n })();\r\n\r\n const resolvedFit = fit ?? defaults.fit;\r\n const resolvedRadius = borderRadius ?? defaults.borderRadius;\r\n\r\n const imageStyles: Style[] = [styles.image];\r\n if (resolvedWidth !== undefined) {\r\n imageStyles.push({ width: resolvedWidth } as Style);\r\n }\r\n if (resolvedHeight !== undefined) {\r\n imageStyles.push({ height: resolvedHeight } as Style);\r\n }\r\n imageStyles.push({\r\n objectFit: resolvedFit,\r\n objectPosition: position,\r\n } as Style);\r\n if (resolvedRadius !== undefined) {\r\n imageStyles.push({ borderRadius: resolvedRadius } as Style);\r\n }\r\n if (variant === \"bordered\") {\r\n imageStyles.push(styles.imageBordered);\r\n }\r\n if (style) {\r\n imageStyles.push(style);\r\n }\r\n\r\n const content = (\r\n <View style={styles.container}>\r\n <Image src={src} style={imageStyles} />\r\n {caption ? <PDFText style={styles.caption}>{caption}</PDFText> : null}\r\n </View>\r\n );\r\n\r\n return noWrap ? (\r\n <View style={[{ breakInside: \"avoid\" as const }].filter(Boolean)}>\r\n {content}\r\n </View>\r\n ) : (\r\n content\r\n );\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n Image,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\n/** HTTP method used when fetching the image from a URL. */\nexport type PdfImageHTTPMethod =\n | \"GET\"\n | \"HEAD\"\n | \"POST\"\n | \"PUT\"\n | \"DELETE\"\n | \"PATCH\";\n\nexport type PdfImageSrc =\n | string\n | {\n uri: string;\n method?: PdfImageHTTPMethod;\n headers?: Record<string, string>;\n body?: string;\n };\n\nexport type PdfImageFit = \"cover\" | \"contain\" | \"fill\" | \"none\";\n\nexport type PdfImageVariant =\n | \"default\"\n | \"full-width\"\n | \"thumbnail\"\n | \"avatar\"\n | \"cover\"\n | \"bordered\"\n | \"rounded\";\n\n/**\n * Image element with layout presets, caption, and aspect ratio support.\n * Props - `src` | `variant` | `width` | `height` | `fit` | `position` | `caption` | `aspectRatio` | `borderRadius` | `noWrap` | `style`\n * @see {@link PdfImageProps}\n */\nexport interface PdfImageProps {\n src: PdfImageSrc;\n /**\n * @default 'default'\n */\n variant?: PdfImageVariant;\n width?: number | string;\n height?: number | string;\n fit?: PdfImageFit;\n /**\n * @default '50% 50%'\n */\n position?: string;\n caption?: string;\n aspectRatio?: number;\n borderRadius?: number;\n /**\n * @default true\n */\n noWrap?: boolean;\n style?: Style;\n}\n\ninterface VariantDefaults {\n width?: number | string;\n height?: number | string;\n fit: PdfImageFit;\n borderRadius?: number;\n}\n\nconst VARIANT_DEFAULTS: Record<PdfImageVariant, VariantDefaults> = {\n avatar: { borderRadius: 999, fit: \"cover\", height: 48, width: 48 },\n bordered: { fit: \"contain\", width: \"100%\" },\n cover: { fit: \"cover\", height: 160, width: \"100%\" },\n default: { fit: \"contain\" },\n \"full-width\": { fit: \"cover\", width: \"100%\" },\n rounded: { borderRadius: 8, fit: \"contain\", width: 200 },\n thumbnail: { fit: \"cover\", height: 80, width: 80 },\n};\n\nconst UNSUPPORTED_FORMATS = new Set([\"webp\", \"avif\", \"heic\", \"heif\", \"ico\"]);\n\nconst detectFormat = (src: PdfImageSrc): string | null => {\n if (typeof src !== \"string\") {\n return null;\n }\n const dataMatch = src.match(/^data:image\\/([a-zA-Z0-9+.-]+)/);\n if (dataMatch) {\n return dataMatch[1].toLowerCase();\n }\n return src.split(\"?\")[0].split(\".\").pop()?.toLowerCase() ?? null;\n};\n\nconst warnIfUnsupported = (src: PdfImageSrc): void => {\n const fmt = detectFormat(src);\n if (fmt && UNSUPPORTED_FORMATS.has(fmt)) {\n console.warn(\n `[PdfImage] Unsupported format \"${fmt}\" detected. react-pdf supports: JPEG, PNG, GIF (first frame), BMP, SVG. Convert to PNG or JPEG before use.`\n );\n }\n};\n\nconst createImageStyles = (t: PdfcnTheme) => {\n const { spacing } = t.primitives;\n return StyleSheet.create({\n caption: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginTop: spacing[1],\n textAlign: \"center\",\n },\n container: { flexDirection: \"column\" },\n image: {},\n imageBordered: {\n borderColor: t.colors.border,\n borderStyle: \"solid\",\n borderWidth: 1,\n },\n });\n};\n\nexport const PdfImage = ({\n src,\n variant = \"default\",\n width,\n height,\n fit,\n position = \"50% 50%\",\n caption,\n aspectRatio,\n borderRadius,\n noWrap = true,\n style,\n}: PdfImageProps) => {\n warnIfUnsupported(src);\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createImageStyles(theme), [theme]);\n const defaults = VARIANT_DEFAULTS[variant];\n\n const resolvedWidth = width ?? defaults.width;\n const resolvedHeight: number | string | undefined = (() => {\n if (height !== undefined) {\n return height;\n }\n if (defaults.height !== undefined) {\n return defaults.height;\n }\n if (aspectRatio !== undefined && typeof resolvedWidth === \"number\") {\n return resolvedWidth / aspectRatio;\n }\n })();\n\n const resolvedFit = fit ?? defaults.fit;\n const resolvedRadius = borderRadius ?? defaults.borderRadius;\n\n const imageStyles: Style[] = [styles.image];\n if (resolvedWidth !== undefined) {\n imageStyles.push({ width: resolvedWidth } as Style);\n }\n if (resolvedHeight !== undefined) {\n imageStyles.push({ height: resolvedHeight } as Style);\n }\n imageStyles.push({\n objectFit: resolvedFit,\n objectPosition: position,\n } as Style);\n if (resolvedRadius !== undefined) {\n imageStyles.push({ borderRadius: resolvedRadius } as Style);\n }\n if (variant === \"bordered\") {\n imageStyles.push(styles.imageBordered);\n }\n if (style) {\n imageStyles.push(style);\n }\n\n const content = (\n <View style={styles.container}>\n <Image src={src} style={imageStyles} />\n {caption ? <PDFText style={styles.caption}>{caption}</PDFText> : null}\n </View>\n );\n\n return noWrap ? (\n <View style={[{ breakInside: \"avoid\" as const }].filter(Boolean)}>\n {content}\n </View>\n ) : (\n content\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/pdf-image/pdf-image.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/press-release.json b/apps/web/public/r/takumi/press-release.json
index 55b212a..4059b31 100644
--- a/apps/web/public/r/takumi/press-release.json
+++ b/apps/web/public/r/takumi/press-release.json
@@ -18,7 +18,7 @@
"files": [
{
"path": "registry/bases/takumi/blocks/press-release/press-release.tsx",
- "content": "import { PageFooter } from \"@/registry/bases/takumi/components/page-footer/page-footer\";\nimport { PageHeader } from \"@/registry/bases/takumi/components/page-header/page-header\";\nimport { PdfImage } from \"@/registry/bases/takumi/components/pdf-image/pdf-image\";\nimport { Section } from \"@/registry/bases/takumi/components/section/section\";\nimport { Text } from \"@/registry/bases/takumi/components/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n Document,\n Page,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type { PressReleaseProps } from \"./press-release.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: PressReleaseProps = {\n accentColor: \"#1e40af\",\n address: \"123 Market St, San Francisco, CA 94103\",\n body: [\n \"Acme Corp today announced the launch of pdfcn, an open-source React component library for generating professional PDF documents.\",\n \"pdfcn is designed to work seamlessly with shadcn/ui and follows the same registry-based distribution model, letting developers add print-ready document blocks with a single CLI command.\",\n ],\n boilerplate:\n \"Acme Corp is a leading provider of developer tools and open-source software.\",\n companyName: \"Acme Corp\",\n date: \"September 10, 2026\",\n dateline: { city: \"San Francisco\", state: \"CA\" },\n headline: \"Acme Corp Launches Revolutionary PDF Toolkit for Developers\",\n mediaContact: {\n email: \"[email protected]\",\n name: \"Press Team\",\n phone: \"(555) 123-4567\",\n },\n quotes: [\n {\n author: \"Jane Doe\",\n text: \"We built pdfcn because generating PDFs in React was unnecessarily painful. Now it feels like writing any other component.\",\n title: \"CTO, Acme Corp\",\n },\n ],\n socialLinks: [\n { platform: \"GitHub\", url: \"https://github.com/acme\" },\n { platform: \"X\", url: \"https://x.com/acme\" },\n ],\n subheadline:\n \"New open-source library makes generating professional PDFs in React effortless\",\n};\n\nconst PressReleaseContent = ({ data }: { data: PressReleaseProps }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n columnHeading: {\n fontSize: 9,\n fontWeight: \"bold\",\n marginBottom: 2,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n });\n\n return (\n <Document title={`Press Release — ${data.companyName}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"logo-left\"\n logo={\n data.companyLogo ? (\n <PdfImage src={data.companyLogo} style={{ margin: 0 }} />\n ) : undefined\n }\n title={data.companyName}\n rightText={data.date}\n style={{ marginBottom: 0 }}\n />\n <Section spacing=\"none\">\n <Text\n variant=\"xs\"\n weight=\"bold\"\n transform=\"uppercase\"\n color={data.accentColor ?? \"mutedForeground\"}\n noMargin\n >\n For Immediate Release\n </Text>\n <Text variant=\"2xl\" weight=\"bold\" noMargin>\n {data.headline}\n </Text>\n {data.subheadline && (\n <Text variant=\"lg\" color=\"mutedForeground\" noMargin>\n {data.subheadline}\n </Text>\n )}\n </Section>\n <Section spacing=\"none\">\n <Text variant=\"sm\" weight=\"semibold\" transform=\"uppercase\" noMargin>\n {`${data.dateline.city}, ${data.dateline.state} — ${data.date}`}\n </Text>\n {data.body.map((paragraph) => (\n <Text key={paragraph.slice(0, 24)} variant=\"sm\">\n {paragraph}\n </Text>\n ))}\n </Section>\n {data.quotes?.map((quote) => (\n <Section\n key={quote.author}\n spacing=\"sm\"\n variant=\"callout\"\n accentColor={data.accentColor}\n >\n <Text variant=\"base\" italic noMargin>\n {`“${quote.text}”`}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {`— ${quote.author}, ${quote.title}`}\n </Text>\n </Section>\n ))}\n <Section spacing=\"sm\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n {`About ${data.companyName}`}\n </Text>\n <Text variant=\"sm\" noMargin>\n {data.boilerplate}\n </Text>\n </Section>\n <Section spacing=\"none\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Media Contact\n </Text>\n <Text noMargin variant=\"xs\">\n {data.mediaContact.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.mediaContact.email}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.mediaContact.phone}\n </Text>\n {data.mediaContact.website && (\n <Text noMargin variant=\"xs\">\n {data.mediaContact.website}\n </Text>\n )}\n </Section>\n <Text align=\"center\" variant=\"sm\" weight=\"medium\" noMargin>\n ###\n </Text>\n <PageFooter\n leftText={data.address ?? data.companyName}\n rightText={\n data.socialLinks?.length\n ? data.socialLinks.map((link) => link.platform).join(\" · \")\n : undefined\n }\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const PressReleaseDocument = ({\n theme,\n data,\n ...props\n}: {\n theme?: PdfcnTheme;\n data?: PressReleaseProps;\n} & Partial<PressReleaseProps>) => (\n <PdfcnThemeProvider theme={theme}>\n <PressReleaseContent data={{ ...sampleData, ...data, ...props }} />\n </PdfcnThemeProvider>\n);\n",
+ "content": "import { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { PdfImage } from \"@/components/pdf/pdf-image/pdf-image\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Document,\n Page,\n StyleSheet,\n} from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { PressReleaseProps } from \"./press-release.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: PressReleaseProps = {\n accentColor: \"#1e40af\",\n address: \"123 Market St, San Francisco, CA 94103\",\n body: [\n \"Acme Corp today announced the launch of pdfcn, an open-source React component library for generating professional PDF documents.\",\n \"pdfcn is designed to work seamlessly with shadcn/ui and follows the same registry-based distribution model, letting developers add print-ready document blocks with a single CLI command.\",\n ],\n boilerplate:\n \"Acme Corp is a leading provider of developer tools and open-source software.\",\n companyName: \"Acme Corp\",\n date: \"September 10, 2026\",\n dateline: { city: \"San Francisco\", state: \"CA\" },\n headline: \"Acme Corp Launches Revolutionary PDF Toolkit for Developers\",\n mediaContact: {\n email: \"[email protected]\",\n name: \"Press Team\",\n phone: \"(555) 123-4567\",\n },\n quotes: [\n {\n author: \"Jane Doe\",\n text: \"We built pdfcn because generating PDFs in React was unnecessarily painful. Now it feels like writing any other component.\",\n title: \"CTO, Acme Corp\",\n },\n ],\n socialLinks: [\n { platform: \"GitHub\", url: \"https://github.com/acme\" },\n { platform: \"X\", url: \"https://x.com/acme\" },\n ],\n subheadline:\n \"New open-source library makes generating professional PDFs in React effortless\",\n};\n\nconst PressReleaseContent = ({ data }: { data: PressReleaseProps }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n columnHeading: {\n fontSize: 9,\n fontWeight: \"bold\",\n marginBottom: 2,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n });\n\n return (\n <Document title={`Press Release — ${data.companyName}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"logo-left\"\n logo={\n data.companyLogo ? (\n <PdfImage src={data.companyLogo} style={{ margin: 0 }} />\n ) : undefined\n }\n title={data.companyName}\n rightText={data.date}\n style={{ marginBottom: 0 }}\n />\n <Section spacing=\"none\">\n <Text\n variant=\"xs\"\n weight=\"bold\"\n transform=\"uppercase\"\n color={data.accentColor ?? \"mutedForeground\"}\n noMargin\n >\n For Immediate Release\n </Text>\n <Text variant=\"2xl\" weight=\"bold\" noMargin>\n {data.headline}\n </Text>\n {data.subheadline && (\n <Text variant=\"lg\" color=\"mutedForeground\" noMargin>\n {data.subheadline}\n </Text>\n )}\n </Section>\n <Section spacing=\"none\">\n <Text variant=\"sm\" weight=\"semibold\" transform=\"uppercase\" noMargin>\n {`${data.dateline.city}, ${data.dateline.state} — ${data.date}`}\n </Text>\n {data.body.map((paragraph) => (\n <Text key={paragraph.slice(0, 24)} variant=\"sm\">\n {paragraph}\n </Text>\n ))}\n </Section>\n {data.quotes?.map((quote) => (\n <Section\n key={quote.author}\n spacing=\"sm\"\n variant=\"callout\"\n accentColor={data.accentColor}\n >\n <Text variant=\"base\" italic noMargin>\n {`“${quote.text}”`}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {`— ${quote.author}, ${quote.title}`}\n </Text>\n </Section>\n ))}\n <Section spacing=\"sm\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n {`About ${data.companyName}`}\n </Text>\n <Text variant=\"sm\" noMargin>\n {data.boilerplate}\n </Text>\n </Section>\n <Section spacing=\"none\">\n <Text\n style={styles.columnHeading}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Media Contact\n </Text>\n <Text noMargin variant=\"xs\">\n {data.mediaContact.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.mediaContact.email}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.mediaContact.phone}\n </Text>\n {data.mediaContact.website && (\n <Text noMargin variant=\"xs\">\n {data.mediaContact.website}\n </Text>\n )}\n </Section>\n <Text align=\"center\" variant=\"sm\" weight=\"medium\" noMargin>\n ###\n </Text>\n <PageFooter\n leftText={data.address ?? data.companyName}\n rightText={\n data.socialLinks?.length\n ? data.socialLinks.map((link) => link.platform).join(\" · \")\n : undefined\n }\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const PressReleaseDocument = ({\n theme,\n data,\n ...props\n}: {\n theme?: PdfcnTheme;\n data?: PressReleaseProps;\n} & Partial<PressReleaseProps>) => (\n <PdfcnThemeProvider theme={theme}>\n <PressReleaseContent data={{ ...sampleData, ...data, ...props }} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/press-release/press-release.tsx"
},
@@ -30,4 +30,4 @@
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/qrcode.json b/apps/web/public/r/takumi/qrcode.json
index 16dafd2..7e41e85 100644
--- a/apps/web/public/r/takumi/qrcode.json
+++ b/apps/web/public/r/takumi/qrcode.json
@@ -14,10 +14,10 @@
"files": [
{
"path": "registry/bases/takumi/components/qrcode/qrcode.tsx",
- "content": "import QRCode from \"qrcode\";\r\n\r\nimport {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n Text as PDFText,\r\n StyleSheet,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport { Rect, Svg } from \"@/registry/bases/takumi/lib/pdf-svg\";\r\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type QRCodeErrorLevel = \"L\" | \"M\" | \"Q\" | \"H\";\r\n\r\n/**\r\n * QR code rendered as an SVG grid for use in PDF documents.\r\n * Props - `value` | `size` | `color` | `backgroundColor` | `errorLevel` | `margin` | `caption` | `style`\r\n * @see {@link PdfQRCodeProps}\r\n */\r\nexport interface PdfQRCodeProps extends Omit<PDFComponentProps, \"children\"> {\r\n value: string;\r\n size?: number;\r\n color?: string;\r\n backgroundColor?: string;\r\n errorLevel?: QRCodeErrorLevel;\r\n margin?: number;\r\n caption?: string;\r\n children?: never;\r\n}\r\n\r\nconst createQRCodeStyles = (t: PdfcnTheme) => {\r\n const { spacing } = t.primitives;\r\n return StyleSheet.create({\r\n caption: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.primitives.typography.xs,\r\n marginTop: spacing[1],\r\n textAlign: \"center\",\r\n },\r\n container: { alignItems: \"center\" },\r\n });\r\n};\r\n\r\nconst generateQRMatrix = (\r\n value: string,\r\n errorLevel: QRCodeErrorLevel,\r\n margin: number\r\n): boolean[][] => {\r\n const qr = QRCode.create(value, { errorCorrectionLevel: errorLevel });\r\n const { size, data } = qr.modules;\r\n const totalSize = size + margin * 2;\r\n const matrix: boolean[][] = [];\r\n for (let row = 0; row < totalSize; row += 1) {\r\n const rowData: boolean[] = [];\r\n for (let col = 0; col < totalSize; col += 1) {\r\n const isInMargin =\r\n row < margin ||\r\n row >= size + margin ||\r\n col < margin ||\r\n col >= size + margin;\r\n if (isInMargin) {\r\n rowData.push(false);\r\n } else {\r\n rowData.push(data[(row - margin) * size + (col - margin)] === 1);\r\n }\r\n }\r\n matrix.push(rowData);\r\n }\r\n return matrix;\r\n};\r\n\r\nexport const PdfQRCode = ({\r\n value,\r\n size = 100,\r\n color = \"#000000\",\r\n backgroundColor = \"#ffffff\",\r\n errorLevel = \"M\",\r\n margin = 2,\r\n caption,\r\n style,\r\n}: PdfQRCodeProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createQRCodeStyles(theme), [theme]);\r\n const matrix = useSafeMemo(\r\n () => generateQRMatrix(value, errorLevel, margin),\r\n [value, errorLevel, margin]\r\n );\r\n const moduleSize = size / matrix.length;\r\n const resolvedColor = resolveColor(color, theme.colors);\r\n const resolvedBgColor =\r\n backgroundColor === \"transparent\"\r\n ? undefined\r\n : resolveColor(backgroundColor, theme.colors);\r\n const containerStyles: Style[] = [styles.container];\r\n if (style) {\r\n containerStyles.push(...[style].flat());\r\n }\r\n\r\n return (\r\n <View style={containerStyles}>\r\n <Svg width={size} height={size} viewBox={`0 0 ${size} ${size}`}>\r\n {resolvedBgColor !== undefined && (\r\n <Rect x={0} y={0} width={size} height={size} fill={resolvedBgColor} />\r\n )}\r\n {matrix\r\n .flatMap((row, y) =>\r\n row\r\n .map((isDark, x) => (isDark ? { x, y } : null))\r\n .filter((pos): pos is { x: number; y: number } => pos !== null)\r\n )\r\n .map((pos) => (\r\n <Rect\r\n key={`qr-${pos.y}-${pos.x}`}\r\n x={pos.x * moduleSize}\r\n y={pos.y * moduleSize}\r\n width={moduleSize}\r\n height={moduleSize}\r\n fill={resolvedColor}\r\n />\r\n ))}\r\n </Svg>\r\n {caption && <PDFText style={styles.caption}>{caption}</PDFText>}\r\n </View>\r\n );\r\n};\r\n",
+ "content": "import QRCode from \"qrcode\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { Rect, Svg } from \"@/lib/pdf-svg\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type QRCodeErrorLevel = \"L\" | \"M\" | \"Q\" | \"H\";\n\n/**\n * QR code rendered as an SVG grid for use in PDF documents.\n * Props - `value` | `size` | `color` | `backgroundColor` | `errorLevel` | `margin` | `caption` | `style`\n * @see {@link PdfQRCodeProps}\n */\nexport interface PdfQRCodeProps extends Omit<PDFComponentProps, \"children\"> {\n value: string;\n size?: number;\n color?: string;\n backgroundColor?: string;\n errorLevel?: QRCodeErrorLevel;\n margin?: number;\n caption?: string;\n children?: never;\n}\n\nconst createQRCodeStyles = (t: PdfcnTheme) => {\n const { spacing } = t.primitives;\n return StyleSheet.create({\n caption: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginTop: spacing[1],\n textAlign: \"center\",\n },\n container: { alignItems: \"center\" },\n });\n};\n\nconst generateQRMatrix = (\n value: string,\n errorLevel: QRCodeErrorLevel,\n margin: number\n): boolean[][] => {\n const qr = QRCode.create(value, { errorCorrectionLevel: errorLevel });\n const { size, data } = qr.modules;\n const totalSize = size + margin * 2;\n const matrix: boolean[][] = [];\n for (let row = 0; row < totalSize; row += 1) {\n const rowData: boolean[] = [];\n for (let col = 0; col < totalSize; col += 1) {\n const isInMargin =\n row < margin ||\n row >= size + margin ||\n col < margin ||\n col >= size + margin;\n if (isInMargin) {\n rowData.push(false);\n } else {\n rowData.push(data[(row - margin) * size + (col - margin)] === 1);\n }\n }\n matrix.push(rowData);\n }\n return matrix;\n};\n\nexport const PdfQRCode = ({\n value,\n size = 100,\n color = \"#000000\",\n backgroundColor = \"#ffffff\",\n errorLevel = \"M\",\n margin = 2,\n caption,\n style,\n}: PdfQRCodeProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createQRCodeStyles(theme), [theme]);\n const matrix = useSafeMemo(\n () => generateQRMatrix(value, errorLevel, margin),\n [value, errorLevel, margin]\n );\n const moduleSize = size / matrix.length;\n const resolvedColor = resolveColor(color, theme.colors);\n const resolvedBgColor =\n backgroundColor === \"transparent\"\n ? undefined\n : resolveColor(backgroundColor, theme.colors);\n const containerStyles: Style[] = [styles.container];\n if (style) {\n containerStyles.push(...[style].flat());\n }\n\n return (\n <View style={containerStyles}>\n <Svg width={size} height={size} viewBox={`0 0 ${size} ${size}`}>\n {resolvedBgColor !== undefined && (\n <Rect x={0} y={0} width={size} height={size} fill={resolvedBgColor} />\n )}\n {matrix\n .flatMap((row, y) =>\n row\n .map((isDark, x) => (isDark ? { x, y } : null))\n .filter((pos): pos is { x: number; y: number } => pos !== null)\n )\n .map((pos) => (\n <Rect\n key={`qr-${pos.y}-${pos.x}`}\n x={pos.x * moduleSize}\n y={pos.y * moduleSize}\n width={moduleSize}\n height={moduleSize}\n fill={resolvedColor}\n />\n ))}\n </Svg>\n {caption && <PDFText style={styles.caption}>{caption}</PDFText>}\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/qrcode/qrcode.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/report-financial.json b/apps/web/public/r/takumi/report-financial.json
index 2d35683..63dcfa1 100644
--- a/apps/web/public/r/takumi/report-financial.json
+++ b/apps/web/public/r/takumi/report-financial.json
@@ -14,6 +14,7 @@
"@pdfcn/takumi/key-value",
"@pdfcn/takumi/page-footer",
"@pdfcn/takumi/page-header",
+ "@pdfcn/takumi/page-number",
"@pdfcn/takumi/graph",
"@pdfcn/takumi/list",
"@pdfcn/takumi/section",
@@ -22,22 +23,22 @@
"files": [
{
"path": "registry/bases/takumi/blocks/report-financial/report-financial.tsx",
- "content": "import { ReportTemplateFrame } from \"./report-layout\";\r\nimport type { ReportTemplateProps } from \"./report-layout\";\r\nimport type { BaseReportData } from \"./report.types\";\r\n\r\nconst sampleFinancialData: BaseReportData = {\r\n author: \"Finance Ops\",\r\n generatedAt: \"February 23, 2026\",\r\n highlights: [\r\n \"Revenue accelerated after enterprise expansion campaign launch.\",\r\n \"Gross margin improved due to infrastructure cost renegotiation.\",\r\n \"Collections requires executive follow-up on two overdue accounts.\",\r\n ],\r\n period: \"Q1 2026\",\r\n rows: [\r\n {\r\n label: \"Enterprise Sales\",\r\n owner: \"A. Patel\",\r\n progress: 88,\r\n risk: \"Low\",\r\n status: \"On Track\",\r\n },\r\n {\r\n label: \"SMB Sales\",\r\n owner: \"L. Khan\",\r\n progress: 79,\r\n risk: \"Medium\",\r\n status: \"On Track\",\r\n },\r\n {\r\n label: \"Collections\",\r\n owner: \"J. Reyes\",\r\n progress: 63,\r\n risk: \"High\",\r\n status: \"At Risk\",\r\n },\r\n {\r\n label: \"Cost Optimization\",\r\n owner: \"K. Singh\",\r\n progress: 82,\r\n risk: \"Low\",\r\n status: \"On Track\",\r\n },\r\n ],\r\n series: [\r\n { label: \"W1\", value: 72 },\r\n { label: \"W2\", value: 74 },\r\n { label: \"W3\", value: 76 },\r\n { label: \"W4\", value: 77 },\r\n { label: \"W5\", value: 79 },\r\n { label: \"W6\", value: 80 },\r\n { label: \"W7\", value: 81 },\r\n { label: \"W8\", value: 83 },\r\n { label: \"W9\", value: 82 },\r\n { label: \"W10\", value: 84 },\r\n { label: \"W11\", value: 86 },\r\n { label: \"W12\", value: 88 },\r\n ],\r\n subtitle: \"Revenue, margin, and expense control overview\",\r\n summary: [\r\n { label: \"Revenue\", tone: \"success\", trend: \"+14.2% QoQ\", value: \"$2.48M\" },\r\n {\r\n label: \"Gross Margin\",\r\n tone: \"success\",\r\n trend: \"+2.1 pts\",\r\n value: \"61.8%\",\r\n },\r\n { label: \"Opex\", tone: \"success\", trend: \"-3.4% QoQ\", value: \"$0.93M\" },\r\n { label: \"Runway\", tone: \"info\", trend: \"Stable\", value: \"22 months\" },\r\n ],\r\n title: \"Quarterly Financial Report\",\r\n};\r\n\r\nexport const FinancialReportDocument = ({\r\n theme,\r\n data = sampleFinancialData,\r\n}: ReportTemplateProps) => (\r\n <ReportTemplateFrame\r\n theme={theme}\r\n data={data}\r\n titlePrefix=\"Financial Report\"\r\n statusLabel=\"Finance: Healthy\"\r\n statusTone=\"success\"\r\n graphVariant=\"line\"\r\n graphTitle=\"Revenue trajectory\"\r\n graphSubtitle=\"Quarterly weighted revenue index\"\r\n graphLegend=\"none\"\r\n graphColors={[\"#0F172A\"]}\r\n />\r\n);\r\n",
+ "content": "import { ReportTemplateFrame } from \"./report-layout\";\nimport type { ReportTemplateProps } from \"./report-layout\";\nimport type { BaseReportData } from \"./report.types\";\n\nconst sampleFinancialData: BaseReportData = {\n author: \"Finance Ops\",\n generatedAt: \"February 23, 2026\",\n highlights: [\n \"Revenue accelerated after enterprise expansion campaign launch.\",\n \"Gross margin improved due to infrastructure cost renegotiation.\",\n \"Collections requires executive follow-up on two overdue accounts.\",\n ],\n period: \"Q1 2026\",\n rows: [\n {\n label: \"Enterprise Sales\",\n owner: \"A. Patel\",\n progress: 88,\n risk: \"Low\",\n status: \"On Track\",\n },\n {\n label: \"SMB Sales\",\n owner: \"L. Khan\",\n progress: 79,\n risk: \"Medium\",\n status: \"On Track\",\n },\n {\n label: \"Collections\",\n owner: \"J. Reyes\",\n progress: 63,\n risk: \"High\",\n status: \"At Risk\",\n },\n {\n label: \"Cost Optimization\",\n owner: \"K. Singh\",\n progress: 82,\n risk: \"Low\",\n status: \"On Track\",\n },\n ],\n series: [\n { label: \"W1\", value: 72 },\n { label: \"W2\", value: 74 },\n { label: \"W3\", value: 76 },\n { label: \"W4\", value: 77 },\n { label: \"W5\", value: 79 },\n { label: \"W6\", value: 80 },\n { label: \"W7\", value: 81 },\n { label: \"W8\", value: 83 },\n { label: \"W9\", value: 82 },\n { label: \"W10\", value: 84 },\n { label: \"W11\", value: 86 },\n { label: \"W12\", value: 88 },\n ],\n subtitle: \"Revenue, margin, and expense control overview\",\n summary: [\n { label: \"Revenue\", tone: \"success\", trend: \"+14.2% QoQ\", value: \"$2.48M\" },\n {\n label: \"Gross Margin\",\n tone: \"success\",\n trend: \"+2.1 pts\",\n value: \"61.8%\",\n },\n { label: \"Opex\", tone: \"success\", trend: \"-3.4% QoQ\", value: \"$0.93M\" },\n { label: \"Runway\", tone: \"info\", trend: \"Stable\", value: \"22 months\" },\n ],\n title: \"Quarterly Financial Report\",\n};\n\nexport const FinancialReportDocument = ({\n theme,\n data = sampleFinancialData,\n}: ReportTemplateProps) => (\n <ReportTemplateFrame\n theme={theme}\n data={data}\n titlePrefix=\"Financial Report\"\n statusLabel=\"Finance: Healthy\"\n statusTone=\"success\"\n graphVariant=\"line\"\n graphTitle=\"Revenue trajectory\"\n graphSubtitle=\"Quarterly weighted revenue index\"\n graphLegend=\"none\"\n graphColors={[\"#0F172A\"]}\n />\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-financial/report-financial.tsx"
},
{
"path": "registry/bases/takumi/blocks/report-financial/report-layout.tsx",
- "content": "import { Badge } from \"@/registry/bases/takumi/components/badge/badge\";\r\nimport { DataTable } from \"@/registry/bases/takumi/components/data-table/data-table\";\r\nimport { PdfGraph } from \"@/registry/bases/takumi/components/graph/graph\";\r\nimport { KeyValue } from \"@/registry/bases/takumi/components/key-value/key-value\";\r\nimport { PdfList } from \"@/registry/bases/takumi/components/list/list\";\r\nimport { PageFooter } from \"@/registry/bases/takumi/components/page-footer/page-footer\";\r\nimport { PageHeader } from \"@/registry/bases/takumi/components/page-header/page-header\";\r\nimport { PageNumber } from \"@/registry/bases/takumi/components/page-number/page-number\";\r\nimport { Section } from \"@/registry/bases/takumi/components/section/section\";\r\nimport { Text } from \"@/registry/bases/takumi/components/text/text\";\r\nimport {\r\n PdfcnThemeProvider,\r\n usePdfcnTheme,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n StyleSheet,\r\n Document,\r\n Page,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { BaseReportData } from \"./report.types\";\r\n\r\nexport interface ReportTemplateProps {\r\n theme?: PdfcnTheme;\r\n data?: BaseReportData;\r\n}\r\n\r\ntype ReportGraphVariant =\r\n | \"bar\"\r\n | \"horizontal-bar\"\r\n | \"line\"\r\n | \"area\"\r\n | \"pie\"\r\n | \"donut\";\r\n\r\ninterface ReportLayoutProps {\r\n data: BaseReportData;\r\n titlePrefix: string;\r\n statusLabel: string;\r\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n graphVariant: ReportGraphVariant;\r\n graphTitle: string;\r\n graphSubtitle: string;\r\n graphLegend?: \"bottom\" | \"right\" | \"none\";\r\n graphShowValues?: boolean;\r\n graphColors?: string[];\r\n graphData?: { label: string; value: number }[];\r\n}\r\n\r\nconst toneColor = (\r\n theme: PdfcnTheme,\r\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\r\n) => {\r\n if (tone === \"success\") {\r\n return theme.colors.success;\r\n }\r\n if (tone === \"warning\") {\r\n return theme.colors.warning;\r\n }\r\n if (tone === \"destructive\") {\r\n return theme.colors.destructive;\r\n }\r\n return theme.colors.info;\r\n};\r\n\r\nexport const ReportLayout = ({\r\n data,\r\n titlePrefix,\r\n statusLabel,\r\n statusTone,\r\n graphVariant,\r\n graphTitle,\r\n graphSubtitle,\r\n graphLegend = \"none\",\r\n graphShowValues = false,\r\n graphColors,\r\n graphData,\r\n}: ReportLayoutProps) => {\r\n const theme = usePdfcnTheme();\r\n const accent = toneColor(theme, statusTone);\r\n const deliveryOffset: Record<ReportGraphVariant, number> = {\r\n area: 0,\r\n bar: 31,\r\n donut: 65,\r\n \"horizontal-bar\": -2,\r\n line: -31,\r\n pie: 0,\r\n };\r\n const graphHeight: Record<ReportGraphVariant, number> = {\r\n area: 191,\r\n bar: 184,\r\n donut: 193,\r\n \"horizontal-bar\": 163,\r\n line: 195,\r\n pie: 191,\r\n };\r\n const graphOffset: Record<ReportGraphVariant, number> = {\r\n area: 0,\r\n bar: 0,\r\n donut: 0,\r\n \"horizontal-bar\": 0,\r\n line: 0,\r\n pie: 0,\r\n };\r\n const styles = StyleSheet.create({\r\n col: {\r\n flex: 1,\r\n },\r\n graphShell: {\r\n backgroundColor: theme.colors.background,\r\n borderColor: theme.colors.border,\r\n borderRadius: theme.primitives.borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n padding: 12,\r\n },\r\n metricCard: {\r\n backgroundColor: theme.colors.background,\r\n borderColor: theme.colors.border,\r\n borderRadius: theme.primitives.borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n padding: 8,\r\n width: \"48.6%\",\r\n },\r\n metricLabel: {\r\n color: theme.colors.mutedForeground,\r\n fontSize: 8,\r\n letterSpacing: 0.5,\r\n marginBottom: 2,\r\n textTransform: \"uppercase\",\r\n },\r\n metricTrend: {\r\n color: theme.colors.mutedForeground,\r\n fontSize: 9,\r\n },\r\n metricValue: {\r\n color: theme.colors.foreground,\r\n fontSize: 14,\r\n fontWeight: theme.primitives.fontWeights.bold,\r\n marginBottom: 2,\r\n },\r\n metricsGrid: {\r\n flexDirection: \"row\",\r\n flexWrap: \"wrap\",\r\n gap: 8,\r\n },\r\n page: {\r\n backgroundColor: theme.colors.background,\r\n boxSizing: \"border-box\",\r\n minHeight: 841,\r\n paddingBottom: theme.spacing.page.marginBottom,\r\n paddingLeft: theme.spacing.page.marginLeft,\r\n paddingRight: theme.spacing.page.marginRight,\r\n paddingTop: theme.spacing.page.marginTop,\r\n position: \"relative\",\r\n },\r\n pageBreak: {\r\n breakAfter: \"page\",\r\n },\r\n toolbar: {\r\n alignItems: \"center\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n marginBottom: 8,\r\n },\r\n twoColumn: {\r\n alignItems: \"flex-start\",\r\n flexDirection: \"row\",\r\n gap: 10,\r\n },\r\n });\r\n\r\n return (\r\n <Document title={`${titlePrefix} ${data.period}`}>\r\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\r\n <PageHeader\r\n variant=\"two-column\"\r\n title={data.title}\r\n subtitle={`${titlePrefix} · ${data.subtitle}`}\r\n rightText={data.period}\r\n rightSubText={`Generated ${data.generatedAt}`}\r\n marginBottom={14}\r\n />\r\n\r\n <View style={styles.toolbar}>\r\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\r\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\r\n Author: {data.author}\r\n </Text>\r\n </View>\r\n\r\n <Section variant=\"card\" padding=\"md\" noWrap>\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Executive Summary\r\n </Text>\r\n <View style={styles.metricsGrid}>\r\n {data.summary.map((metric) => (\r\n <View\r\n key={metric.label}\r\n style={[\r\n styles.metricCard,\r\n {\r\n borderLeftColor: metric.tone\r\n ? toneColor(theme, metric.tone)\r\n : accent,\r\n borderLeftWidth: 3,\r\n },\r\n ]}\r\n >\r\n <Text style={styles.metricLabel} noMargin>\r\n {metric.label}\r\n </Text>\r\n <Text style={styles.metricValue} noMargin>\r\n {metric.value}\r\n </Text>\r\n {metric.trend ? (\r\n <Badge\r\n label={metric.trend}\r\n size=\"sm\"\r\n variant={metric.tone ?? \"info\"}\r\n />\r\n ) : null}\r\n </View>\r\n ))}\r\n </View>\r\n </Section>\r\n\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText={<PageNumber size=\"xs\" />}\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n </Page>\r\n\r\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\r\n <Section\r\n padding=\"md\"\r\n noWrap\r\n style={\r\n graphVariant === \"horizontal-bar\" ? { marginTop: -6 } : undefined\r\n }\r\n >\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Performance Trend\r\n </Text>\r\n <View\r\n style={[\r\n styles.graphShell,\r\n {\r\n marginTop: graphVariant === \"horizontal-bar\" ? 34 : 0,\r\n position: \"relative\",\r\n top: graphOffset[graphVariant],\r\n },\r\n ]}\r\n >\r\n <PdfGraph\r\n variant={graphVariant}\r\n data={graphData ?? data.series}\r\n title={graphTitle}\r\n subtitle={graphSubtitle}\r\n yLabel={undefined}\r\n xLabel={undefined}\r\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\r\n showValues={graphShowValues}\r\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\r\n legend={graphLegend}\r\n height={graphHeight[graphVariant]}\r\n colors={graphColors}\r\n fullWidth\r\n containerPadding={12}\r\n wrapperPadding={12}\r\n style={{ marginBottom: 0 }}\r\n />\r\n </View>\r\n </Section>\r\n\r\n <Section\r\n padding=\"md\"\r\n style={{\r\n position: \"relative\",\r\n top: deliveryOffset[graphVariant],\r\n }}\r\n >\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Delivery Table\r\n </Text>\r\n <DataTable\r\n variant=\"compact\"\r\n size=\"compact\"\r\n stripe\r\n columns={[\r\n { header: \"Stream\", key: \"label\" },\r\n { header: \"Owner\", key: \"owner\" },\r\n { align: \"center\", header: \"Status\", key: \"status\" },\r\n {\r\n align: \"right\",\r\n header: \"Progress\",\r\n key: \"progress\",\r\n render: (value) => `${String(value)}%`,\r\n },\r\n { align: \"right\", header: \"Risk\", key: \"risk\" },\r\n ]}\r\n data={data.rows}\r\n footer={{\r\n label: \"Totals\",\r\n owner: \"-\",\r\n progress: Math.round(\r\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\r\n Math.max(data.rows.length, 1)\r\n ),\r\n risk: \"-\",\r\n status: \"-\",\r\n }}\r\n />\r\n </Section>\r\n\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText={<PageNumber size=\"xs\" />}\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n </Page>\r\n\r\n <Page size=\"A4\" style={styles.page}>\r\n <Section padding=\"md\" variant=\"card\" noWrap>\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Highlights & Risks\r\n </Text>\r\n <View style={styles.twoColumn}>\r\n <View style={styles.col}>\r\n <PdfList\r\n variant=\"checklist\"\r\n items={data.highlights.map((item) => ({\r\n checked: true,\r\n text: item,\r\n }))}\r\n gap=\"sm\"\r\n />\r\n </View>\r\n <View style={styles.col}>\r\n <KeyValue\r\n size=\"sm\"\r\n divided\r\n items={[\r\n {\r\n key: \"Open Risks\",\r\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\r\n },\r\n {\r\n key: \"On-Track Streams\",\r\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\r\n },\r\n {\r\n key: \"Avg Progress\",\r\n value: `${Math.round(\r\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\r\n Math.max(data.rows.length, 1)\r\n )}%`,\r\n },\r\n ]}\r\n />\r\n </View>\r\n </View>\r\n </Section>\r\n\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText={<PageNumber size=\"xs\" />}\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n </Page>\r\n </Document>\r\n );\r\n};\r\n\r\nexport const ReportTemplateFrame = ({\r\n theme,\r\n data,\r\n titlePrefix,\r\n statusLabel,\r\n statusTone,\r\n graphVariant,\r\n graphTitle,\r\n graphSubtitle,\r\n graphLegend,\r\n graphShowValues,\r\n graphColors,\r\n graphData,\r\n}: ReportTemplateProps & {\r\n titlePrefix: string;\r\n statusLabel: string;\r\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n graphVariant: ReportGraphVariant;\r\n graphTitle: string;\r\n graphSubtitle: string;\r\n graphLegend?: \"bottom\" | \"right\" | \"none\";\r\n graphShowValues?: boolean;\r\n graphColors?: string[];\r\n graphData?: { label: string; value: number }[];\r\n}) => {\r\n if (!data) {\r\n return null;\r\n }\r\n\r\n return (\r\n <PdfcnThemeProvider theme={theme}>\r\n <ReportLayout\r\n data={data}\r\n titlePrefix={titlePrefix}\r\n statusLabel={statusLabel}\r\n statusTone={statusTone}\r\n graphVariant={graphVariant}\r\n graphTitle={graphTitle}\r\n graphSubtitle={graphSubtitle}\r\n graphLegend={graphLegend}\r\n graphShowValues={graphShowValues}\r\n graphColors={graphColors}\r\n graphData={graphData}\r\n />\r\n </PdfcnThemeProvider>\r\n );\r\n};\r\n",
+ "content": "import { Badge } from \"@/components/pdf/badge/badge\";\nimport { DataTable } from \"@/components/pdf/data-table/data-table\";\nimport { PdfGraph } from \"@/components/pdf/graph/graph\";\nimport { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PdfList } from \"@/components/pdf/list/list\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { PageNumber } from \"@/components/pdf/page-number/page-number\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n const deliveryOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 31,\n donut: 65,\n \"horizontal-bar\": -2,\n line: -31,\n pie: 0,\n };\n const graphHeight: Record<ReportGraphVariant, number> = {\n area: 191,\n bar: 184,\n donut: 193,\n \"horizontal-bar\": 163,\n line: 195,\n pie: 191,\n };\n const graphOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 0,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n const styles = StyleSheet.create({\n col: {\n flex: 1,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 8,\n width: \"48.6%\",\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n paddingBottom: theme.spacing.page.marginBottom,\n paddingLeft: theme.spacing.page.marginLeft,\n paddingRight: theme.spacing.page.marginRight,\n paddingTop: theme.spacing.page.marginTop,\n position: \"relative\",\n },\n pageBreak: {\n breakAfter: \"page\",\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {data.summary.map((metric) => (\n <View\n key={metric.label}\n style={[\n styles.metricCard,\n {\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n },\n ]}\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n />\n ) : null}\n </View>\n ))}\n </View>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\n <Section\n padding=\"md\"\n noWrap\n style={\n graphVariant === \"horizontal-bar\" ? { marginTop: -6 } : undefined\n }\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Performance Trend\n </Text>\n <View\n style={[\n styles.graphShell,\n {\n marginTop: graphVariant === \"horizontal-bar\" ? 34 : 0,\n position: \"relative\",\n top: graphOffset[graphVariant],\n },\n ]}\n >\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={graphHeight[graphVariant]}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section\n padding=\"md\"\n style={{\n position: \"relative\",\n top: deliveryOffset[graphVariant],\n }}\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n\n <Page size=\"A4\" style={styles.page}>\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Avg Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-financial/report-layout.tsx"
},
{
"path": "registry/bases/takumi/blocks/report-financial/report.types.ts",
- "content": "export interface SummaryMetric {\r\n label: string;\r\n value: string;\r\n trend?: string;\r\n tone?: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n}\r\n\r\nexport type ReportRow = Record<string, unknown> & {\r\n label: string;\r\n owner: string;\r\n status: string;\r\n progress: number;\r\n risk?: string;\r\n};\r\n\r\nexport interface ReportSeriesPoint {\r\n label: string;\r\n value: number;\r\n}\r\n\r\nexport interface BaseReportData {\r\n title: string;\r\n subtitle: string;\r\n generatedAt: string;\r\n period: string;\r\n author: string;\r\n summary: SummaryMetric[];\r\n rows: ReportRow[];\r\n series: ReportSeriesPoint[];\r\n highlights: string[];\r\n}\r\n",
+ "content": "export interface SummaryMetric {\n label: string;\n value: string;\n trend?: string;\n tone?: \"success\" | \"warning\" | \"destructive\" | \"info\";\n}\n\nexport type ReportRow = Record<string, unknown> & {\n label: string;\n owner: string;\n status: string;\n progress: number;\n risk?: string;\n};\n\nexport interface ReportSeriesPoint {\n label: string;\n value: number;\n}\n\nexport interface BaseReportData {\n title: string;\n subtitle: string;\n generatedAt: string;\n period: string;\n author: string;\n summary: SummaryMetric[];\n rows: ReportRow[];\n series: ReportSeriesPoint[];\n highlights: string[];\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-financial/report.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/report-marketing.json b/apps/web/public/r/takumi/report-marketing.json
index f927f57..c790835 100644
--- a/apps/web/public/r/takumi/report-marketing.json
+++ b/apps/web/public/r/takumi/report-marketing.json
@@ -14,6 +14,7 @@
"@pdfcn/takumi/key-value",
"@pdfcn/takumi/page-footer",
"@pdfcn/takumi/page-header",
+ "@pdfcn/takumi/page-number",
"@pdfcn/takumi/graph",
"@pdfcn/takumi/list",
"@pdfcn/takumi/section",
@@ -22,22 +23,22 @@
"files": [
{
"path": "registry/bases/takumi/blocks/report-marketing/report-layout.tsx",
- "content": "import { Badge } from \"@/registry/bases/takumi/components/badge/badge\";\r\nimport { DataTable } from \"@/registry/bases/takumi/components/data-table/data-table\";\r\nimport { PdfGraph } from \"@/registry/bases/takumi/components/graph/graph\";\r\nimport { KeyValue } from \"@/registry/bases/takumi/components/key-value/key-value\";\r\nimport { PdfList } from \"@/registry/bases/takumi/components/list/list\";\r\nimport { PageFooter } from \"@/registry/bases/takumi/components/page-footer/page-footer\";\r\nimport { PageHeader } from \"@/registry/bases/takumi/components/page-header/page-header\";\r\nimport { PageNumber } from \"@/registry/bases/takumi/components/page-number/page-number\";\r\nimport { Section } from \"@/registry/bases/takumi/components/section/section\";\r\nimport { Text } from \"@/registry/bases/takumi/components/text/text\";\r\nimport {\r\n PdfcnThemeProvider,\r\n usePdfcnTheme,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n StyleSheet,\r\n Document,\r\n Page,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { BaseReportData } from \"./report.types\";\r\n\r\nexport interface ReportTemplateProps {\r\n theme?: PdfcnTheme;\r\n data?: BaseReportData;\r\n}\r\n\r\ntype ReportGraphVariant =\r\n | \"bar\"\r\n | \"horizontal-bar\"\r\n | \"line\"\r\n | \"area\"\r\n | \"pie\"\r\n | \"donut\";\r\n\r\ninterface ReportLayoutProps {\r\n data: BaseReportData;\r\n titlePrefix: string;\r\n statusLabel: string;\r\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n graphVariant: ReportGraphVariant;\r\n graphTitle: string;\r\n graphSubtitle: string;\r\n graphLegend?: \"bottom\" | \"right\" | \"none\";\r\n graphShowValues?: boolean;\r\n graphColors?: string[];\r\n graphData?: { label: string; value: number }[];\r\n}\r\n\r\nconst toneColor = (\r\n theme: PdfcnTheme,\r\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\r\n) => {\r\n if (tone === \"success\") {\r\n return theme.colors.success;\r\n }\r\n if (tone === \"warning\") {\r\n return theme.colors.warning;\r\n }\r\n if (tone === \"destructive\") {\r\n return theme.colors.destructive;\r\n }\r\n return theme.colors.info;\r\n};\r\n\r\nexport const ReportLayout = ({\r\n data,\r\n titlePrefix,\r\n statusLabel,\r\n statusTone,\r\n graphVariant,\r\n graphTitle,\r\n graphSubtitle,\r\n graphLegend = \"none\",\r\n graphShowValues = false,\r\n graphColors,\r\n graphData,\r\n}: ReportLayoutProps) => {\r\n const theme = usePdfcnTheme();\r\n const accent = toneColor(theme, statusTone);\r\n const deliveryOffset: Record<ReportGraphVariant, number> = {\r\n area: 0,\r\n bar: 31,\r\n donut: 65,\r\n \"horizontal-bar\": -2,\r\n line: -31,\r\n pie: 0,\r\n };\r\n const graphHeight: Record<ReportGraphVariant, number> = {\r\n area: 191,\r\n bar: 184,\r\n donut: 193,\r\n \"horizontal-bar\": 163,\r\n line: 195,\r\n pie: 191,\r\n };\r\n const graphOffset: Record<ReportGraphVariant, number> = {\r\n area: 0,\r\n bar: 0,\r\n donut: 0,\r\n \"horizontal-bar\": 0,\r\n line: 0,\r\n pie: 0,\r\n };\r\n const styles = StyleSheet.create({\r\n col: {\r\n flex: 1,\r\n },\r\n graphShell: {\r\n backgroundColor: theme.colors.background,\r\n borderColor: theme.colors.border,\r\n borderRadius: theme.primitives.borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n padding: 12,\r\n },\r\n metricCard: {\r\n backgroundColor: theme.colors.background,\r\n borderColor: theme.colors.border,\r\n borderRadius: theme.primitives.borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n padding: 8,\r\n width: \"48.6%\",\r\n },\r\n metricLabel: {\r\n color: theme.colors.mutedForeground,\r\n fontSize: 8,\r\n letterSpacing: 0.5,\r\n marginBottom: 2,\r\n textTransform: \"uppercase\",\r\n },\r\n metricTrend: {\r\n color: theme.colors.mutedForeground,\r\n fontSize: 9,\r\n },\r\n metricValue: {\r\n color: theme.colors.foreground,\r\n fontSize: 14,\r\n fontWeight: theme.primitives.fontWeights.bold,\r\n marginBottom: 2,\r\n },\r\n metricsGrid: {\r\n flexDirection: \"row\",\r\n flexWrap: \"wrap\",\r\n gap: 8,\r\n },\r\n page: {\r\n backgroundColor: theme.colors.background,\r\n boxSizing: \"border-box\",\r\n minHeight: 841,\r\n paddingBottom: theme.spacing.page.marginBottom,\r\n paddingLeft: theme.spacing.page.marginLeft,\r\n paddingRight: theme.spacing.page.marginRight,\r\n paddingTop: theme.spacing.page.marginTop,\r\n position: \"relative\",\r\n },\r\n pageBreak: {\r\n breakAfter: \"page\",\r\n },\r\n toolbar: {\r\n alignItems: \"center\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n marginBottom: 8,\r\n },\r\n twoColumn: {\r\n alignItems: \"flex-start\",\r\n flexDirection: \"row\",\r\n gap: 10,\r\n },\r\n });\r\n\r\n return (\r\n <Document title={`${titlePrefix} ${data.period}`}>\r\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\r\n <PageHeader\r\n variant=\"two-column\"\r\n title={data.title}\r\n subtitle={`${titlePrefix} · ${data.subtitle}`}\r\n rightText={data.period}\r\n rightSubText={`Generated ${data.generatedAt}`}\r\n marginBottom={14}\r\n />\r\n\r\n <View style={styles.toolbar}>\r\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\r\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\r\n Author: {data.author}\r\n </Text>\r\n </View>\r\n\r\n <Section variant=\"card\" padding=\"md\" noWrap>\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Executive Summary\r\n </Text>\r\n <View style={styles.metricsGrid}>\r\n {data.summary.map((metric) => (\r\n <View\r\n key={metric.label}\r\n style={[\r\n styles.metricCard,\r\n {\r\n borderLeftColor: metric.tone\r\n ? toneColor(theme, metric.tone)\r\n : accent,\r\n borderLeftWidth: 3,\r\n },\r\n ]}\r\n >\r\n <Text style={styles.metricLabel} noMargin>\r\n {metric.label}\r\n </Text>\r\n <Text style={styles.metricValue} noMargin>\r\n {metric.value}\r\n </Text>\r\n {metric.trend ? (\r\n <Badge\r\n label={metric.trend}\r\n size=\"sm\"\r\n variant={metric.tone ?? \"info\"}\r\n />\r\n ) : null}\r\n </View>\r\n ))}\r\n </View>\r\n </Section>\r\n\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText={<PageNumber size=\"xs\" />}\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n </Page>\r\n\r\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\r\n <Section\r\n padding=\"md\"\r\n noWrap\r\n style={\r\n graphVariant === \"horizontal-bar\" ? { marginTop: -6 } : undefined\r\n }\r\n >\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Performance Trend\r\n </Text>\r\n <View\r\n style={[\r\n styles.graphShell,\r\n {\r\n marginTop: graphVariant === \"horizontal-bar\" ? 34 : 0,\r\n position: \"relative\",\r\n top: graphOffset[graphVariant],\r\n },\r\n ]}\r\n >\r\n <PdfGraph\r\n variant={graphVariant}\r\n data={graphData ?? data.series}\r\n title={graphTitle}\r\n subtitle={graphSubtitle}\r\n yLabel={undefined}\r\n xLabel={undefined}\r\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\r\n showValues={graphShowValues}\r\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\r\n legend={graphLegend}\r\n height={graphHeight[graphVariant]}\r\n colors={graphColors}\r\n fullWidth\r\n containerPadding={12}\r\n wrapperPadding={12}\r\n style={{ marginBottom: 0 }}\r\n />\r\n </View>\r\n </Section>\r\n\r\n <Section\r\n padding=\"md\"\r\n style={{\r\n position: \"relative\",\r\n top: deliveryOffset[graphVariant],\r\n }}\r\n >\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Delivery Table\r\n </Text>\r\n <DataTable\r\n variant=\"compact\"\r\n size=\"compact\"\r\n stripe\r\n columns={[\r\n { header: \"Stream\", key: \"label\" },\r\n { header: \"Owner\", key: \"owner\" },\r\n { align: \"center\", header: \"Status\", key: \"status\" },\r\n {\r\n align: \"right\",\r\n header: \"Progress\",\r\n key: \"progress\",\r\n render: (value) => `${String(value)}%`,\r\n },\r\n { align: \"right\", header: \"Risk\", key: \"risk\" },\r\n ]}\r\n data={data.rows}\r\n footer={{\r\n label: \"Totals\",\r\n owner: \"-\",\r\n progress: Math.round(\r\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\r\n Math.max(data.rows.length, 1)\r\n ),\r\n risk: \"-\",\r\n status: \"-\",\r\n }}\r\n />\r\n </Section>\r\n\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText={<PageNumber size=\"xs\" />}\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n </Page>\r\n\r\n <Page size=\"A4\" style={styles.page}>\r\n <Section padding=\"md\" variant=\"card\" noWrap>\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Highlights & Risks\r\n </Text>\r\n <View style={styles.twoColumn}>\r\n <View style={styles.col}>\r\n <PdfList\r\n variant=\"checklist\"\r\n items={data.highlights.map((item) => ({\r\n checked: true,\r\n text: item,\r\n }))}\r\n gap=\"sm\"\r\n />\r\n </View>\r\n <View style={styles.col}>\r\n <KeyValue\r\n size=\"sm\"\r\n divided\r\n items={[\r\n {\r\n key: \"Open Risks\",\r\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\r\n },\r\n {\r\n key: \"On-Track Streams\",\r\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\r\n },\r\n {\r\n key: \"Avg Progress\",\r\n value: `${Math.round(\r\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\r\n Math.max(data.rows.length, 1)\r\n )}%`,\r\n },\r\n ]}\r\n />\r\n </View>\r\n </View>\r\n </Section>\r\n\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText={<PageNumber size=\"xs\" />}\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n </Page>\r\n </Document>\r\n );\r\n};\r\n\r\nexport const ReportTemplateFrame = ({\r\n theme,\r\n data,\r\n titlePrefix,\r\n statusLabel,\r\n statusTone,\r\n graphVariant,\r\n graphTitle,\r\n graphSubtitle,\r\n graphLegend,\r\n graphShowValues,\r\n graphColors,\r\n graphData,\r\n}: ReportTemplateProps & {\r\n titlePrefix: string;\r\n statusLabel: string;\r\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n graphVariant: ReportGraphVariant;\r\n graphTitle: string;\r\n graphSubtitle: string;\r\n graphLegend?: \"bottom\" | \"right\" | \"none\";\r\n graphShowValues?: boolean;\r\n graphColors?: string[];\r\n graphData?: { label: string; value: number }[];\r\n}) => {\r\n if (!data) {\r\n return null;\r\n }\r\n\r\n return (\r\n <PdfcnThemeProvider theme={theme}>\r\n <ReportLayout\r\n data={data}\r\n titlePrefix={titlePrefix}\r\n statusLabel={statusLabel}\r\n statusTone={statusTone}\r\n graphVariant={graphVariant}\r\n graphTitle={graphTitle}\r\n graphSubtitle={graphSubtitle}\r\n graphLegend={graphLegend}\r\n graphShowValues={graphShowValues}\r\n graphColors={graphColors}\r\n graphData={graphData}\r\n />\r\n </PdfcnThemeProvider>\r\n );\r\n};\r\n",
+ "content": "import { Badge } from \"@/components/pdf/badge/badge\";\nimport { DataTable } from \"@/components/pdf/data-table/data-table\";\nimport { PdfGraph } from \"@/components/pdf/graph/graph\";\nimport { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PdfList } from \"@/components/pdf/list/list\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { PageNumber } from \"@/components/pdf/page-number/page-number\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n const deliveryOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 31,\n donut: 65,\n \"horizontal-bar\": -2,\n line: -31,\n pie: 0,\n };\n const graphHeight: Record<ReportGraphVariant, number> = {\n area: 191,\n bar: 184,\n donut: 193,\n \"horizontal-bar\": 163,\n line: 195,\n pie: 191,\n };\n const graphOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 0,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n const styles = StyleSheet.create({\n col: {\n flex: 1,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 8,\n width: \"48.6%\",\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n paddingBottom: theme.spacing.page.marginBottom,\n paddingLeft: theme.spacing.page.marginLeft,\n paddingRight: theme.spacing.page.marginRight,\n paddingTop: theme.spacing.page.marginTop,\n position: \"relative\",\n },\n pageBreak: {\n breakAfter: \"page\",\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {data.summary.map((metric) => (\n <View\n key={metric.label}\n style={[\n styles.metricCard,\n {\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n },\n ]}\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n />\n ) : null}\n </View>\n ))}\n </View>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\n <Section\n padding=\"md\"\n noWrap\n style={\n graphVariant === \"horizontal-bar\" ? { marginTop: -6 } : undefined\n }\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Performance Trend\n </Text>\n <View\n style={[\n styles.graphShell,\n {\n marginTop: graphVariant === \"horizontal-bar\" ? 34 : 0,\n position: \"relative\",\n top: graphOffset[graphVariant],\n },\n ]}\n >\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={graphHeight[graphVariant]}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section\n padding=\"md\"\n style={{\n position: \"relative\",\n top: deliveryOffset[graphVariant],\n }}\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n\n <Page size=\"A4\" style={styles.page}>\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Avg Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-marketing/report-layout.tsx"
},
{
"path": "registry/bases/takumi/blocks/report-marketing/report-marketing.tsx",
- "content": "import { ReportTemplateFrame } from \"./report-layout\";\r\nimport type { ReportTemplateProps } from \"./report-layout\";\r\nimport type { BaseReportData } from \"./report.types\";\r\n\r\nconst sampleMarketingData: BaseReportData = {\r\n author: \"Growth Team\",\r\n generatedAt: \"February 23, 2026\",\r\n highlights: [\r\n \"Channel mix improved CAC while maintaining lead quality.\",\r\n \"Lifecycle email workflow has deliverability issues under investigation.\",\r\n \"Referral program is producing higher-intent pipeline with lower cost.\",\r\n ],\r\n period: \"Campaign Cycle 2026-02\",\r\n rows: [\r\n {\r\n label: \"SEO\",\r\n owner: \"H. Evans\",\r\n progress: 84,\r\n risk: \"Low\",\r\n status: \"On Track\",\r\n },\r\n {\r\n label: \"Paid Search\",\r\n owner: \"K. Martin\",\r\n progress: 80,\r\n risk: \"Low\",\r\n status: \"On Track\",\r\n },\r\n {\r\n label: \"Lifecycle Email\",\r\n owner: \"V. Lee\",\r\n progress: 64,\r\n risk: \"Medium\",\r\n status: \"At Risk\",\r\n },\r\n {\r\n label: \"Partner Referrals\",\r\n owner: \"J. Gomez\",\r\n progress: 75,\r\n risk: \"Medium\",\r\n status: \"On Track\",\r\n },\r\n ],\r\n series: [\r\n { label: \"W1\", value: 55 },\r\n { label: \"W2\", value: 57 },\r\n { label: \"W3\", value: 59 },\r\n { label: \"W4\", value: 60 },\r\n { label: \"W5\", value: 62 },\r\n { label: \"W6\", value: 63 },\r\n { label: \"W7\", value: 65 },\r\n { label: \"W8\", value: 67 },\r\n { label: \"W9\", value: 66 },\r\n { label: \"W10\", value: 68 },\r\n { label: \"W11\", value: 70 },\r\n { label: \"W12\", value: 72 },\r\n ],\r\n subtitle: \"Pipeline, conversion efficiency, and channel performance\",\r\n summary: [\r\n { label: \"MQLs\", tone: \"success\", trend: \"+22.1% cycle\", value: \"3,940\" },\r\n { label: \"CAC\", tone: \"success\", trend: \"-7.4%\", value: \"$118\" },\r\n { label: \"Win Rate\", tone: \"info\", trend: \"+1.1 pts\", value: \"28.6%\" },\r\n { label: \"Churn Risk\", tone: \"warning\", trend: \"+0.8 pts\", value: \"6.2%\" },\r\n ],\r\n title: \"Growth & Marketing Report\",\r\n};\r\n\r\nexport const MarketingReportDocument = ({\r\n theme,\r\n data = sampleMarketingData,\r\n}: ReportTemplateProps) => (\r\n <ReportTemplateFrame\r\n theme={theme}\r\n data={data}\r\n titlePrefix=\"Growth Report\"\r\n statusLabel=\"Growth: Strong\"\r\n statusTone=\"success\"\r\n graphVariant=\"bar\"\r\n graphTitle=\"Pipeline build by week\"\r\n graphSubtitle=\"Demand creation output trend\"\r\n graphLegend=\"none\"\r\n graphShowValues\r\n graphColors={[\"#0EA5E9\"]}\r\n />\r\n);\r\n",
+ "content": "import { ReportTemplateFrame } from \"./report-layout\";\nimport type { ReportTemplateProps } from \"./report-layout\";\nimport type { BaseReportData } from \"./report.types\";\n\nconst sampleMarketingData: BaseReportData = {\n author: \"Growth Team\",\n generatedAt: \"February 23, 2026\",\n highlights: [\n \"Channel mix improved CAC while maintaining lead quality.\",\n \"Lifecycle email workflow has deliverability issues under investigation.\",\n \"Referral program is producing higher-intent pipeline with lower cost.\",\n ],\n period: \"Campaign Cycle 2026-02\",\n rows: [\n {\n label: \"SEO\",\n owner: \"H. Evans\",\n progress: 84,\n risk: \"Low\",\n status: \"On Track\",\n },\n {\n label: \"Paid Search\",\n owner: \"K. Martin\",\n progress: 80,\n risk: \"Low\",\n status: \"On Track\",\n },\n {\n label: \"Lifecycle Email\",\n owner: \"V. Lee\",\n progress: 64,\n risk: \"Medium\",\n status: \"At Risk\",\n },\n {\n label: \"Partner Referrals\",\n owner: \"J. Gomez\",\n progress: 75,\n risk: \"Medium\",\n status: \"On Track\",\n },\n ],\n series: [\n { label: \"W1\", value: 55 },\n { label: \"W2\", value: 57 },\n { label: \"W3\", value: 59 },\n { label: \"W4\", value: 60 },\n { label: \"W5\", value: 62 },\n { label: \"W6\", value: 63 },\n { label: \"W7\", value: 65 },\n { label: \"W8\", value: 67 },\n { label: \"W9\", value: 66 },\n { label: \"W10\", value: 68 },\n { label: \"W11\", value: 70 },\n { label: \"W12\", value: 72 },\n ],\n subtitle: \"Pipeline, conversion efficiency, and channel performance\",\n summary: [\n { label: \"MQLs\", tone: \"success\", trend: \"+22.1% cycle\", value: \"3,940\" },\n { label: \"CAC\", tone: \"success\", trend: \"-7.4%\", value: \"$118\" },\n { label: \"Win Rate\", tone: \"info\", trend: \"+1.1 pts\", value: \"28.6%\" },\n { label: \"Churn Risk\", tone: \"warning\", trend: \"+0.8 pts\", value: \"6.2%\" },\n ],\n title: \"Growth & Marketing Report\",\n};\n\nexport const MarketingReportDocument = ({\n theme,\n data = sampleMarketingData,\n}: ReportTemplateProps) => (\n <ReportTemplateFrame\n theme={theme}\n data={data}\n titlePrefix=\"Growth Report\"\n statusLabel=\"Growth: Strong\"\n statusTone=\"success\"\n graphVariant=\"bar\"\n graphTitle=\"Pipeline build by week\"\n graphSubtitle=\"Demand creation output trend\"\n graphLegend=\"none\"\n graphShowValues\n graphColors={[\"#0EA5E9\"]}\n />\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-marketing/report-marketing.tsx"
},
{
"path": "registry/bases/takumi/blocks/report-marketing/report.types.ts",
- "content": "export interface SummaryMetric {\r\n label: string;\r\n value: string;\r\n trend?: string;\r\n tone?: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n}\r\n\r\nexport type ReportRow = Record<string, unknown> & {\r\n label: string;\r\n owner: string;\r\n status: string;\r\n progress: number;\r\n risk?: string;\r\n};\r\n\r\nexport interface ReportSeriesPoint {\r\n label: string;\r\n value: number;\r\n}\r\n\r\nexport interface BaseReportData {\r\n title: string;\r\n subtitle: string;\r\n generatedAt: string;\r\n period: string;\r\n author: string;\r\n summary: SummaryMetric[];\r\n rows: ReportRow[];\r\n series: ReportSeriesPoint[];\r\n highlights: string[];\r\n}\r\n",
+ "content": "export interface SummaryMetric {\n label: string;\n value: string;\n trend?: string;\n tone?: \"success\" | \"warning\" | \"destructive\" | \"info\";\n}\n\nexport type ReportRow = Record<string, unknown> & {\n label: string;\n owner: string;\n status: string;\n progress: number;\n risk?: string;\n};\n\nexport interface ReportSeriesPoint {\n label: string;\n value: number;\n}\n\nexport interface BaseReportData {\n title: string;\n subtitle: string;\n generatedAt: string;\n period: string;\n author: string;\n summary: SummaryMetric[];\n rows: ReportRow[];\n series: ReportSeriesPoint[];\n highlights: string[];\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-marketing/report.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/report-operations.json b/apps/web/public/r/takumi/report-operations.json
index 735b060..41d7756 100644
--- a/apps/web/public/r/takumi/report-operations.json
+++ b/apps/web/public/r/takumi/report-operations.json
@@ -14,6 +14,7 @@
"@pdfcn/takumi/key-value",
"@pdfcn/takumi/page-footer",
"@pdfcn/takumi/page-header",
+ "@pdfcn/takumi/page-number",
"@pdfcn/takumi/graph",
"@pdfcn/takumi/list",
"@pdfcn/takumi/section",
@@ -22,22 +23,22 @@
"files": [
{
"path": "registry/bases/takumi/blocks/report-operations/report-layout.tsx",
- "content": "import { Badge } from \"@/registry/bases/takumi/components/badge/badge\";\r\nimport { DataTable } from \"@/registry/bases/takumi/components/data-table/data-table\";\r\nimport { PdfGraph } from \"@/registry/bases/takumi/components/graph/graph\";\r\nimport { KeyValue } from \"@/registry/bases/takumi/components/key-value/key-value\";\r\nimport { PdfList } from \"@/registry/bases/takumi/components/list/list\";\r\nimport { PageFooter } from \"@/registry/bases/takumi/components/page-footer/page-footer\";\r\nimport { PageHeader } from \"@/registry/bases/takumi/components/page-header/page-header\";\r\nimport { PageNumber } from \"@/registry/bases/takumi/components/page-number/page-number\";\r\nimport { Section } from \"@/registry/bases/takumi/components/section/section\";\r\nimport { Text } from \"@/registry/bases/takumi/components/text/text\";\r\nimport {\r\n PdfcnThemeProvider,\r\n usePdfcnTheme,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n StyleSheet,\r\n Document,\r\n Page,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { BaseReportData } from \"./report.types\";\r\n\r\nexport interface ReportTemplateProps {\r\n theme?: PdfcnTheme;\r\n data?: BaseReportData;\r\n}\r\n\r\ntype ReportGraphVariant =\r\n | \"bar\"\r\n | \"horizontal-bar\"\r\n | \"line\"\r\n | \"area\"\r\n | \"pie\"\r\n | \"donut\";\r\n\r\ninterface ReportLayoutProps {\r\n data: BaseReportData;\r\n titlePrefix: string;\r\n statusLabel: string;\r\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n graphVariant: ReportGraphVariant;\r\n graphTitle: string;\r\n graphSubtitle: string;\r\n graphLegend?: \"bottom\" | \"right\" | \"none\";\r\n graphShowValues?: boolean;\r\n graphColors?: string[];\r\n graphData?: { label: string; value: number }[];\r\n}\r\n\r\nconst toneColor = (\r\n theme: PdfcnTheme,\r\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\r\n) => {\r\n if (tone === \"success\") {\r\n return theme.colors.success;\r\n }\r\n if (tone === \"warning\") {\r\n return theme.colors.warning;\r\n }\r\n if (tone === \"destructive\") {\r\n return theme.colors.destructive;\r\n }\r\n return theme.colors.info;\r\n};\r\n\r\nexport const ReportLayout = ({\r\n data,\r\n titlePrefix,\r\n statusLabel,\r\n statusTone,\r\n graphVariant,\r\n graphTitle,\r\n graphSubtitle,\r\n graphLegend = \"none\",\r\n graphShowValues = false,\r\n graphColors,\r\n graphData,\r\n}: ReportLayoutProps) => {\r\n const theme = usePdfcnTheme();\r\n const accent = toneColor(theme, statusTone);\r\n const deliveryOffset: Record<ReportGraphVariant, number> = {\r\n area: 0,\r\n bar: 31,\r\n donut: 65,\r\n \"horizontal-bar\": -2,\r\n line: -31,\r\n pie: 0,\r\n };\r\n const graphHeight: Record<ReportGraphVariant, number> = {\r\n area: 191,\r\n bar: 184,\r\n donut: 193,\r\n \"horizontal-bar\": 163,\r\n line: 195,\r\n pie: 191,\r\n };\r\n const graphOffset: Record<ReportGraphVariant, number> = {\r\n area: 0,\r\n bar: 0,\r\n donut: 0,\r\n \"horizontal-bar\": 0,\r\n line: 0,\r\n pie: 0,\r\n };\r\n const styles = StyleSheet.create({\r\n col: {\r\n flex: 1,\r\n },\r\n graphShell: {\r\n backgroundColor: theme.colors.background,\r\n borderColor: theme.colors.border,\r\n borderRadius: theme.primitives.borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n padding: 12,\r\n },\r\n metricCard: {\r\n backgroundColor: theme.colors.background,\r\n borderColor: theme.colors.border,\r\n borderRadius: theme.primitives.borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n padding: 8,\r\n width: \"48.6%\",\r\n },\r\n metricLabel: {\r\n color: theme.colors.mutedForeground,\r\n fontSize: 8,\r\n letterSpacing: 0.5,\r\n marginBottom: 2,\r\n textTransform: \"uppercase\",\r\n },\r\n metricTrend: {\r\n color: theme.colors.mutedForeground,\r\n fontSize: 9,\r\n },\r\n metricValue: {\r\n color: theme.colors.foreground,\r\n fontSize: 14,\r\n fontWeight: theme.primitives.fontWeights.bold,\r\n marginBottom: 2,\r\n },\r\n metricsGrid: {\r\n flexDirection: \"row\",\r\n flexWrap: \"wrap\",\r\n gap: 8,\r\n },\r\n page: {\r\n backgroundColor: theme.colors.background,\r\n boxSizing: \"border-box\",\r\n minHeight: 841,\r\n paddingBottom: theme.spacing.page.marginBottom,\r\n paddingLeft: theme.spacing.page.marginLeft,\r\n paddingRight: theme.spacing.page.marginRight,\r\n paddingTop: theme.spacing.page.marginTop,\r\n position: \"relative\",\r\n },\r\n pageBreak: {\r\n breakAfter: \"page\",\r\n },\r\n toolbar: {\r\n alignItems: \"center\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n marginBottom: 8,\r\n },\r\n twoColumn: {\r\n alignItems: \"flex-start\",\r\n flexDirection: \"row\",\r\n gap: 10,\r\n },\r\n });\r\n\r\n return (\r\n <Document title={`${titlePrefix} ${data.period}`}>\r\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\r\n <PageHeader\r\n variant=\"two-column\"\r\n title={data.title}\r\n subtitle={`${titlePrefix} · ${data.subtitle}`}\r\n rightText={data.period}\r\n rightSubText={`Generated ${data.generatedAt}`}\r\n marginBottom={14}\r\n />\r\n\r\n <View style={styles.toolbar}>\r\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\r\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\r\n Author: {data.author}\r\n </Text>\r\n </View>\r\n\r\n <Section variant=\"card\" padding=\"md\" noWrap>\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Executive Summary\r\n </Text>\r\n <View style={styles.metricsGrid}>\r\n {data.summary.map((metric) => (\r\n <View\r\n key={metric.label}\r\n style={[\r\n styles.metricCard,\r\n {\r\n borderLeftColor: metric.tone\r\n ? toneColor(theme, metric.tone)\r\n : accent,\r\n borderLeftWidth: 3,\r\n },\r\n ]}\r\n >\r\n <Text style={styles.metricLabel} noMargin>\r\n {metric.label}\r\n </Text>\r\n <Text style={styles.metricValue} noMargin>\r\n {metric.value}\r\n </Text>\r\n {metric.trend ? (\r\n <Badge\r\n label={metric.trend}\r\n size=\"sm\"\r\n variant={metric.tone ?? \"info\"}\r\n />\r\n ) : null}\r\n </View>\r\n ))}\r\n </View>\r\n </Section>\r\n\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText={<PageNumber size=\"xs\" />}\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n </Page>\r\n\r\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\r\n <Section\r\n padding=\"md\"\r\n noWrap\r\n style={\r\n graphVariant === \"horizontal-bar\" ? { marginTop: -6 } : undefined\r\n }\r\n >\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Performance Trend\r\n </Text>\r\n <View\r\n style={[\r\n styles.graphShell,\r\n {\r\n marginTop: graphVariant === \"horizontal-bar\" ? 34 : 0,\r\n position: \"relative\",\r\n top: graphOffset[graphVariant],\r\n },\r\n ]}\r\n >\r\n <PdfGraph\r\n variant={graphVariant}\r\n data={graphData ?? data.series}\r\n title={graphTitle}\r\n subtitle={graphSubtitle}\r\n yLabel={undefined}\r\n xLabel={undefined}\r\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\r\n showValues={graphShowValues}\r\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\r\n legend={graphLegend}\r\n height={graphHeight[graphVariant]}\r\n colors={graphColors}\r\n fullWidth\r\n containerPadding={12}\r\n wrapperPadding={12}\r\n style={{ marginBottom: 0 }}\r\n />\r\n </View>\r\n </Section>\r\n\r\n <Section\r\n padding=\"md\"\r\n style={{\r\n position: \"relative\",\r\n top: deliveryOffset[graphVariant],\r\n }}\r\n >\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Delivery Table\r\n </Text>\r\n <DataTable\r\n variant=\"compact\"\r\n size=\"compact\"\r\n stripe\r\n columns={[\r\n { header: \"Stream\", key: \"label\" },\r\n { header: \"Owner\", key: \"owner\" },\r\n { align: \"center\", header: \"Status\", key: \"status\" },\r\n {\r\n align: \"right\",\r\n header: \"Progress\",\r\n key: \"progress\",\r\n render: (value) => `${String(value)}%`,\r\n },\r\n { align: \"right\", header: \"Risk\", key: \"risk\" },\r\n ]}\r\n data={data.rows}\r\n footer={{\r\n label: \"Totals\",\r\n owner: \"-\",\r\n progress: Math.round(\r\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\r\n Math.max(data.rows.length, 1)\r\n ),\r\n risk: \"-\",\r\n status: \"-\",\r\n }}\r\n />\r\n </Section>\r\n\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText={<PageNumber size=\"xs\" />}\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n </Page>\r\n\r\n <Page size=\"A4\" style={styles.page}>\r\n <Section padding=\"md\" variant=\"card\" noWrap>\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Highlights & Risks\r\n </Text>\r\n <View style={styles.twoColumn}>\r\n <View style={styles.col}>\r\n <PdfList\r\n variant=\"checklist\"\r\n items={data.highlights.map((item) => ({\r\n checked: true,\r\n text: item,\r\n }))}\r\n gap=\"sm\"\r\n />\r\n </View>\r\n <View style={styles.col}>\r\n <KeyValue\r\n size=\"sm\"\r\n divided\r\n items={[\r\n {\r\n key: \"Open Risks\",\r\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\r\n },\r\n {\r\n key: \"On-Track Streams\",\r\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\r\n },\r\n {\r\n key: \"Avg Progress\",\r\n value: `${Math.round(\r\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\r\n Math.max(data.rows.length, 1)\r\n )}%`,\r\n },\r\n ]}\r\n />\r\n </View>\r\n </View>\r\n </Section>\r\n\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText={<PageNumber size=\"xs\" />}\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n </Page>\r\n </Document>\r\n );\r\n};\r\n\r\nexport const ReportTemplateFrame = ({\r\n theme,\r\n data,\r\n titlePrefix,\r\n statusLabel,\r\n statusTone,\r\n graphVariant,\r\n graphTitle,\r\n graphSubtitle,\r\n graphLegend,\r\n graphShowValues,\r\n graphColors,\r\n graphData,\r\n}: ReportTemplateProps & {\r\n titlePrefix: string;\r\n statusLabel: string;\r\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n graphVariant: ReportGraphVariant;\r\n graphTitle: string;\r\n graphSubtitle: string;\r\n graphLegend?: \"bottom\" | \"right\" | \"none\";\r\n graphShowValues?: boolean;\r\n graphColors?: string[];\r\n graphData?: { label: string; value: number }[];\r\n}) => {\r\n if (!data) {\r\n return null;\r\n }\r\n\r\n return (\r\n <PdfcnThemeProvider theme={theme}>\r\n <ReportLayout\r\n data={data}\r\n titlePrefix={titlePrefix}\r\n statusLabel={statusLabel}\r\n statusTone={statusTone}\r\n graphVariant={graphVariant}\r\n graphTitle={graphTitle}\r\n graphSubtitle={graphSubtitle}\r\n graphLegend={graphLegend}\r\n graphShowValues={graphShowValues}\r\n graphColors={graphColors}\r\n graphData={graphData}\r\n />\r\n </PdfcnThemeProvider>\r\n );\r\n};\r\n",
+ "content": "import { Badge } from \"@/components/pdf/badge/badge\";\nimport { DataTable } from \"@/components/pdf/data-table/data-table\";\nimport { PdfGraph } from \"@/components/pdf/graph/graph\";\nimport { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PdfList } from \"@/components/pdf/list/list\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { PageNumber } from \"@/components/pdf/page-number/page-number\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n const deliveryOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 31,\n donut: 65,\n \"horizontal-bar\": -2,\n line: -31,\n pie: 0,\n };\n const graphHeight: Record<ReportGraphVariant, number> = {\n area: 191,\n bar: 184,\n donut: 193,\n \"horizontal-bar\": 163,\n line: 195,\n pie: 191,\n };\n const graphOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 0,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n const styles = StyleSheet.create({\n col: {\n flex: 1,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 8,\n width: \"48.6%\",\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n paddingBottom: theme.spacing.page.marginBottom,\n paddingLeft: theme.spacing.page.marginLeft,\n paddingRight: theme.spacing.page.marginRight,\n paddingTop: theme.spacing.page.marginTop,\n position: \"relative\",\n },\n pageBreak: {\n breakAfter: \"page\",\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {data.summary.map((metric) => (\n <View\n key={metric.label}\n style={[\n styles.metricCard,\n {\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n },\n ]}\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n />\n ) : null}\n </View>\n ))}\n </View>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\n <Section\n padding=\"md\"\n noWrap\n style={\n graphVariant === \"horizontal-bar\" ? { marginTop: -6 } : undefined\n }\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Performance Trend\n </Text>\n <View\n style={[\n styles.graphShell,\n {\n marginTop: graphVariant === \"horizontal-bar\" ? 34 : 0,\n position: \"relative\",\n top: graphOffset[graphVariant],\n },\n ]}\n >\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={graphHeight[graphVariant]}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section\n padding=\"md\"\n style={{\n position: \"relative\",\n top: deliveryOffset[graphVariant],\n }}\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n\n <Page size=\"A4\" style={styles.page}>\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Avg Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-operations/report-layout.tsx"
},
{
"path": "registry/bases/takumi/blocks/report-operations/report-operations.tsx",
- "content": "import { ReportTemplateFrame } from \"./report-layout\";\r\nimport type { ReportTemplateProps } from \"./report-layout\";\r\nimport type { BaseReportData } from \"./report.types\";\r\n\r\nconst sampleOperationsData: BaseReportData = {\r\n author: \"Delivery Office\",\r\n generatedAt: \"February 23, 2026\",\r\n highlights: [\r\n \"SLA improved after shift rebalancing and incident triage changes.\",\r\n \"Backlog grew in week 4 due to release-related ticket surge.\",\r\n \"Incident queue remediation plan has executive sponsorship and budget.\",\r\n ],\r\n period: \"February 2026\",\r\n rows: [\r\n {\r\n label: \"L1 Support\",\r\n owner: \"N. Mehta\",\r\n progress: 91,\r\n risk: \"Low\",\r\n status: \"On Track\",\r\n },\r\n {\r\n label: \"L2 Support\",\r\n owner: \"D. Chen\",\r\n progress: 85,\r\n risk: \"Low\",\r\n status: \"On Track\",\r\n },\r\n {\r\n label: \"Incident Queue\",\r\n owner: \"R. Walker\",\r\n progress: 66,\r\n risk: \"High\",\r\n status: \"At Risk\",\r\n },\r\n {\r\n label: \"Automation Rollout\",\r\n owner: \"M. Roy\",\r\n progress: 77,\r\n risk: \"Medium\",\r\n status: \"On Track\",\r\n },\r\n ],\r\n series: [\r\n { label: \"W1\", value: 69 },\r\n { label: \"W2\", value: 71 },\r\n { label: \"W3\", value: 73 },\r\n { label: \"W4\", value: 74 },\r\n { label: \"W5\", value: 75 },\r\n { label: \"W6\", value: 76 },\r\n { label: \"W7\", value: 78 },\r\n { label: \"W8\", value: 79 },\r\n { label: \"W9\", value: 78 },\r\n { label: \"W10\", value: 80 },\r\n { label: \"W11\", value: 81 },\r\n { label: \"W12\", value: 83 },\r\n ],\r\n subtitle: \"Delivery throughput, SLA adherence, and backlog visibility\",\r\n summary: [\r\n {\r\n label: \"Tickets Closed\",\r\n tone: \"success\",\r\n trend: \"+9.8% MoM\",\r\n value: \"1,284\",\r\n },\r\n {\r\n label: \"SLA Hit Rate\",\r\n tone: \"success\",\r\n trend: \"+1.4 pts\",\r\n value: \"96.1%\",\r\n },\r\n { label: \"Backlog\", tone: \"warning\", trend: \"+6.0%\", value: \"214\" },\r\n { label: \"Escalations\", tone: \"success\", trend: \"-18.5%\", value: \"17\" },\r\n ],\r\n title: \"Monthly Operations Report\",\r\n};\r\n\r\nexport const OperationsReportDocument = ({\r\n theme,\r\n data = sampleOperationsData,\r\n}: ReportTemplateProps) => (\r\n <ReportTemplateFrame\r\n theme={theme}\r\n data={data}\r\n titlePrefix=\"Operations Report\"\r\n statusLabel=\"Ops: Watch\"\r\n statusTone=\"warning\"\r\n graphVariant=\"horizontal-bar\"\r\n graphTitle=\"Throughput by week\"\r\n graphSubtitle=\"Resolved workload distribution\"\r\n graphLegend=\"none\"\r\n graphShowValues\r\n graphColors={[\"#2563EB\"]}\r\n graphData={[\r\n { label: \"Incident\", value: 66 },\r\n { label: \"Automation\", value: 77 },\r\n { label: \"L2 Support\", value: 85 },\r\n { label: \"L1 Support\", value: 91 },\r\n ]}\r\n />\r\n);\r\n",
+ "content": "import { ReportTemplateFrame } from \"./report-layout\";\nimport type { ReportTemplateProps } from \"./report-layout\";\nimport type { BaseReportData } from \"./report.types\";\n\nconst sampleOperationsData: BaseReportData = {\n author: \"Delivery Office\",\n generatedAt: \"February 23, 2026\",\n highlights: [\n \"SLA improved after shift rebalancing and incident triage changes.\",\n \"Backlog grew in week 4 due to release-related ticket surge.\",\n \"Incident queue remediation plan has executive sponsorship and budget.\",\n ],\n period: \"February 2026\",\n rows: [\n {\n label: \"L1 Support\",\n owner: \"N. Mehta\",\n progress: 91,\n risk: \"Low\",\n status: \"On Track\",\n },\n {\n label: \"L2 Support\",\n owner: \"D. Chen\",\n progress: 85,\n risk: \"Low\",\n status: \"On Track\",\n },\n {\n label: \"Incident Queue\",\n owner: \"R. Walker\",\n progress: 66,\n risk: \"High\",\n status: \"At Risk\",\n },\n {\n label: \"Automation Rollout\",\n owner: \"M. Roy\",\n progress: 77,\n risk: \"Medium\",\n status: \"On Track\",\n },\n ],\n series: [\n { label: \"W1\", value: 69 },\n { label: \"W2\", value: 71 },\n { label: \"W3\", value: 73 },\n { label: \"W4\", value: 74 },\n { label: \"W5\", value: 75 },\n { label: \"W6\", value: 76 },\n { label: \"W7\", value: 78 },\n { label: \"W8\", value: 79 },\n { label: \"W9\", value: 78 },\n { label: \"W10\", value: 80 },\n { label: \"W11\", value: 81 },\n { label: \"W12\", value: 83 },\n ],\n subtitle: \"Delivery throughput, SLA adherence, and backlog visibility\",\n summary: [\n {\n label: \"Tickets Closed\",\n tone: \"success\",\n trend: \"+9.8% MoM\",\n value: \"1,284\",\n },\n {\n label: \"SLA Hit Rate\",\n tone: \"success\",\n trend: \"+1.4 pts\",\n value: \"96.1%\",\n },\n { label: \"Backlog\", tone: \"warning\", trend: \"+6.0%\", value: \"214\" },\n { label: \"Escalations\", tone: \"success\", trend: \"-18.5%\", value: \"17\" },\n ],\n title: \"Monthly Operations Report\",\n};\n\nexport const OperationsReportDocument = ({\n theme,\n data = sampleOperationsData,\n}: ReportTemplateProps) => (\n <ReportTemplateFrame\n theme={theme}\n data={data}\n titlePrefix=\"Operations Report\"\n statusLabel=\"Ops: Watch\"\n statusTone=\"warning\"\n graphVariant=\"horizontal-bar\"\n graphTitle=\"Throughput by week\"\n graphSubtitle=\"Resolved workload distribution\"\n graphLegend=\"none\"\n graphShowValues\n graphColors={[\"#2563EB\"]}\n graphData={[\n { label: \"Incident\", value: 66 },\n { label: \"Automation\", value: 77 },\n { label: \"L2 Support\", value: 85 },\n { label: \"L1 Support\", value: 91 },\n ]}\n />\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-operations/report-operations.tsx"
},
{
"path": "registry/bases/takumi/blocks/report-operations/report.types.ts",
- "content": "export interface SummaryMetric {\r\n label: string;\r\n value: string;\r\n trend?: string;\r\n tone?: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n}\r\n\r\nexport type ReportRow = Record<string, unknown> & {\r\n label: string;\r\n owner: string;\r\n status: string;\r\n progress: number;\r\n risk?: string;\r\n};\r\n\r\nexport interface ReportSeriesPoint {\r\n label: string;\r\n value: number;\r\n}\r\n\r\nexport interface BaseReportData {\r\n title: string;\r\n subtitle: string;\r\n generatedAt: string;\r\n period: string;\r\n author: string;\r\n summary: SummaryMetric[];\r\n rows: ReportRow[];\r\n series: ReportSeriesPoint[];\r\n highlights: string[];\r\n}\r\n",
+ "content": "export interface SummaryMetric {\n label: string;\n value: string;\n trend?: string;\n tone?: \"success\" | \"warning\" | \"destructive\" | \"info\";\n}\n\nexport type ReportRow = Record<string, unknown> & {\n label: string;\n owner: string;\n status: string;\n progress: number;\n risk?: string;\n};\n\nexport interface ReportSeriesPoint {\n label: string;\n value: number;\n}\n\nexport interface BaseReportData {\n title: string;\n subtitle: string;\n generatedAt: string;\n period: string;\n author: string;\n summary: SummaryMetric[];\n rows: ReportRow[];\n series: ReportSeriesPoint[];\n highlights: string[];\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-operations/report.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/report-security.json b/apps/web/public/r/takumi/report-security.json
index b701ec9..fa16f89 100644
--- a/apps/web/public/r/takumi/report-security.json
+++ b/apps/web/public/r/takumi/report-security.json
@@ -14,6 +14,7 @@
"@pdfcn/takumi/key-value",
"@pdfcn/takumi/page-footer",
"@pdfcn/takumi/page-header",
+ "@pdfcn/takumi/page-number",
"@pdfcn/takumi/graph",
"@pdfcn/takumi/list",
"@pdfcn/takumi/section",
@@ -22,22 +23,22 @@
"files": [
{
"path": "registry/bases/takumi/blocks/report-security/report-layout.tsx",
- "content": "import { Badge } from \"@/registry/bases/takumi/components/badge/badge\";\r\nimport { DataTable } from \"@/registry/bases/takumi/components/data-table/data-table\";\r\nimport { PdfGraph } from \"@/registry/bases/takumi/components/graph/graph\";\r\nimport { KeyValue } from \"@/registry/bases/takumi/components/key-value/key-value\";\r\nimport { PdfList } from \"@/registry/bases/takumi/components/list/list\";\r\nimport { PageFooter } from \"@/registry/bases/takumi/components/page-footer/page-footer\";\r\nimport { PageHeader } from \"@/registry/bases/takumi/components/page-header/page-header\";\r\nimport { PageNumber } from \"@/registry/bases/takumi/components/page-number/page-number\";\r\nimport { Section } from \"@/registry/bases/takumi/components/section/section\";\r\nimport { Text } from \"@/registry/bases/takumi/components/text/text\";\r\nimport {\r\n PdfcnThemeProvider,\r\n usePdfcnTheme,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n StyleSheet,\r\n Document,\r\n Page,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nimport type { BaseReportData } from \"./report.types\";\r\n\r\nexport interface ReportTemplateProps {\r\n theme?: PdfcnTheme;\r\n data?: BaseReportData;\r\n}\r\n\r\ntype ReportGraphVariant =\r\n | \"bar\"\r\n | \"horizontal-bar\"\r\n | \"line\"\r\n | \"area\"\r\n | \"pie\"\r\n | \"donut\";\r\n\r\ninterface ReportLayoutProps {\r\n data: BaseReportData;\r\n titlePrefix: string;\r\n statusLabel: string;\r\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n graphVariant: ReportGraphVariant;\r\n graphTitle: string;\r\n graphSubtitle: string;\r\n graphLegend?: \"bottom\" | \"right\" | \"none\";\r\n graphShowValues?: boolean;\r\n graphColors?: string[];\r\n graphData?: { label: string; value: number }[];\r\n}\r\n\r\nconst toneColor = (\r\n theme: PdfcnTheme,\r\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\r\n) => {\r\n if (tone === \"success\") {\r\n return theme.colors.success;\r\n }\r\n if (tone === \"warning\") {\r\n return theme.colors.warning;\r\n }\r\n if (tone === \"destructive\") {\r\n return theme.colors.destructive;\r\n }\r\n return theme.colors.info;\r\n};\r\n\r\nexport const ReportLayout = ({\r\n data,\r\n titlePrefix,\r\n statusLabel,\r\n statusTone,\r\n graphVariant,\r\n graphTitle,\r\n graphSubtitle,\r\n graphLegend = \"none\",\r\n graphShowValues = false,\r\n graphColors,\r\n graphData,\r\n}: ReportLayoutProps) => {\r\n const theme = usePdfcnTheme();\r\n const accent = toneColor(theme, statusTone);\r\n const deliveryOffset: Record<ReportGraphVariant, number> = {\r\n area: 0,\r\n bar: 31,\r\n donut: 65,\r\n \"horizontal-bar\": -2,\r\n line: -31,\r\n pie: 0,\r\n };\r\n const graphHeight: Record<ReportGraphVariant, number> = {\r\n area: 191,\r\n bar: 184,\r\n donut: 193,\r\n \"horizontal-bar\": 163,\r\n line: 195,\r\n pie: 191,\r\n };\r\n const graphOffset: Record<ReportGraphVariant, number> = {\r\n area: 0,\r\n bar: 0,\r\n donut: 0,\r\n \"horizontal-bar\": 0,\r\n line: 0,\r\n pie: 0,\r\n };\r\n const styles = StyleSheet.create({\r\n col: {\r\n flex: 1,\r\n },\r\n graphShell: {\r\n backgroundColor: theme.colors.background,\r\n borderColor: theme.colors.border,\r\n borderRadius: theme.primitives.borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n padding: 12,\r\n },\r\n metricCard: {\r\n backgroundColor: theme.colors.background,\r\n borderColor: theme.colors.border,\r\n borderRadius: theme.primitives.borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: 1,\r\n padding: 8,\r\n width: \"48.6%\",\r\n },\r\n metricLabel: {\r\n color: theme.colors.mutedForeground,\r\n fontSize: 8,\r\n letterSpacing: 0.5,\r\n marginBottom: 2,\r\n textTransform: \"uppercase\",\r\n },\r\n metricTrend: {\r\n color: theme.colors.mutedForeground,\r\n fontSize: 9,\r\n },\r\n metricValue: {\r\n color: theme.colors.foreground,\r\n fontSize: 14,\r\n fontWeight: theme.primitives.fontWeights.bold,\r\n marginBottom: 2,\r\n },\r\n metricsGrid: {\r\n flexDirection: \"row\",\r\n flexWrap: \"wrap\",\r\n gap: 8,\r\n },\r\n page: {\r\n backgroundColor: theme.colors.background,\r\n boxSizing: \"border-box\",\r\n minHeight: 841,\r\n paddingBottom: theme.spacing.page.marginBottom,\r\n paddingLeft: theme.spacing.page.marginLeft,\r\n paddingRight: theme.spacing.page.marginRight,\r\n paddingTop: theme.spacing.page.marginTop,\r\n position: \"relative\",\r\n },\r\n pageBreak: {\r\n breakAfter: \"page\",\r\n },\r\n toolbar: {\r\n alignItems: \"center\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\",\r\n marginBottom: 8,\r\n },\r\n twoColumn: {\r\n alignItems: \"flex-start\",\r\n flexDirection: \"row\",\r\n gap: 10,\r\n },\r\n });\r\n\r\n return (\r\n <Document title={`${titlePrefix} ${data.period}`}>\r\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\r\n <PageHeader\r\n variant=\"two-column\"\r\n title={data.title}\r\n subtitle={`${titlePrefix} · ${data.subtitle}`}\r\n rightText={data.period}\r\n rightSubText={`Generated ${data.generatedAt}`}\r\n marginBottom={14}\r\n />\r\n\r\n <View style={styles.toolbar}>\r\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\r\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\r\n Author: {data.author}\r\n </Text>\r\n </View>\r\n\r\n <Section variant=\"card\" padding=\"md\" noWrap>\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Executive Summary\r\n </Text>\r\n <View style={styles.metricsGrid}>\r\n {data.summary.map((metric) => (\r\n <View\r\n key={metric.label}\r\n style={[\r\n styles.metricCard,\r\n {\r\n borderLeftColor: metric.tone\r\n ? toneColor(theme, metric.tone)\r\n : accent,\r\n borderLeftWidth: 3,\r\n },\r\n ]}\r\n >\r\n <Text style={styles.metricLabel} noMargin>\r\n {metric.label}\r\n </Text>\r\n <Text style={styles.metricValue} noMargin>\r\n {metric.value}\r\n </Text>\r\n {metric.trend ? (\r\n <Badge\r\n label={metric.trend}\r\n size=\"sm\"\r\n variant={metric.tone ?? \"info\"}\r\n />\r\n ) : null}\r\n </View>\r\n ))}\r\n </View>\r\n </Section>\r\n\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText={<PageNumber size=\"xs\" />}\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n </Page>\r\n\r\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\r\n <Section\r\n padding=\"md\"\r\n noWrap\r\n style={\r\n graphVariant === \"horizontal-bar\" ? { marginTop: -6 } : undefined\r\n }\r\n >\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Performance Trend\r\n </Text>\r\n <View\r\n style={[\r\n styles.graphShell,\r\n {\r\n marginTop: graphVariant === \"horizontal-bar\" ? 34 : 0,\r\n position: \"relative\",\r\n top: graphOffset[graphVariant],\r\n },\r\n ]}\r\n >\r\n <PdfGraph\r\n variant={graphVariant}\r\n data={graphData ?? data.series}\r\n title={graphTitle}\r\n subtitle={graphSubtitle}\r\n yLabel={undefined}\r\n xLabel={undefined}\r\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\r\n showValues={graphShowValues}\r\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\r\n legend={graphLegend}\r\n height={graphHeight[graphVariant]}\r\n colors={graphColors}\r\n fullWidth\r\n containerPadding={12}\r\n wrapperPadding={12}\r\n style={{ marginBottom: 0 }}\r\n />\r\n </View>\r\n </Section>\r\n\r\n <Section\r\n padding=\"md\"\r\n style={{\r\n position: \"relative\",\r\n top: deliveryOffset[graphVariant],\r\n }}\r\n >\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Delivery Table\r\n </Text>\r\n <DataTable\r\n variant=\"compact\"\r\n size=\"compact\"\r\n stripe\r\n columns={[\r\n { header: \"Stream\", key: \"label\" },\r\n { header: \"Owner\", key: \"owner\" },\r\n { align: \"center\", header: \"Status\", key: \"status\" },\r\n {\r\n align: \"right\",\r\n header: \"Progress\",\r\n key: \"progress\",\r\n render: (value) => `${String(value)}%`,\r\n },\r\n { align: \"right\", header: \"Risk\", key: \"risk\" },\r\n ]}\r\n data={data.rows}\r\n footer={{\r\n label: \"Totals\",\r\n owner: \"-\",\r\n progress: Math.round(\r\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\r\n Math.max(data.rows.length, 1)\r\n ),\r\n risk: \"-\",\r\n status: \"-\",\r\n }}\r\n />\r\n </Section>\r\n\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText={<PageNumber size=\"xs\" />}\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n </Page>\r\n\r\n <Page size=\"A4\" style={styles.page}>\r\n <Section padding=\"md\" variant=\"card\" noWrap>\r\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\r\n Highlights & Risks\r\n </Text>\r\n <View style={styles.twoColumn}>\r\n <View style={styles.col}>\r\n <PdfList\r\n variant=\"checklist\"\r\n items={data.highlights.map((item) => ({\r\n checked: true,\r\n text: item,\r\n }))}\r\n gap=\"sm\"\r\n />\r\n </View>\r\n <View style={styles.col}>\r\n <KeyValue\r\n size=\"sm\"\r\n divided\r\n items={[\r\n {\r\n key: \"Open Risks\",\r\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\r\n },\r\n {\r\n key: \"On-Track Streams\",\r\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\r\n },\r\n {\r\n key: \"Avg Progress\",\r\n value: `${Math.round(\r\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\r\n Math.max(data.rows.length, 1)\r\n )}%`,\r\n },\r\n ]}\r\n />\r\n </View>\r\n </View>\r\n </Section>\r\n\r\n <PageFooter\r\n variant=\"three-column\"\r\n leftText=\"Confidential — Internal Use\"\r\n centerText=\"Generated with pdfcn\"\r\n rightText={<PageNumber size=\"xs\" />}\r\n sticky\r\n pagePadding={theme.spacing.page.marginLeft}\r\n />\r\n </Page>\r\n </Document>\r\n );\r\n};\r\n\r\nexport const ReportTemplateFrame = ({\r\n theme,\r\n data,\r\n titlePrefix,\r\n statusLabel,\r\n statusTone,\r\n graphVariant,\r\n graphTitle,\r\n graphSubtitle,\r\n graphLegend,\r\n graphShowValues,\r\n graphColors,\r\n graphData,\r\n}: ReportTemplateProps & {\r\n titlePrefix: string;\r\n statusLabel: string;\r\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n graphVariant: ReportGraphVariant;\r\n graphTitle: string;\r\n graphSubtitle: string;\r\n graphLegend?: \"bottom\" | \"right\" | \"none\";\r\n graphShowValues?: boolean;\r\n graphColors?: string[];\r\n graphData?: { label: string; value: number }[];\r\n}) => {\r\n if (!data) {\r\n return null;\r\n }\r\n\r\n return (\r\n <PdfcnThemeProvider theme={theme}>\r\n <ReportLayout\r\n data={data}\r\n titlePrefix={titlePrefix}\r\n statusLabel={statusLabel}\r\n statusTone={statusTone}\r\n graphVariant={graphVariant}\r\n graphTitle={graphTitle}\r\n graphSubtitle={graphSubtitle}\r\n graphLegend={graphLegend}\r\n graphShowValues={graphShowValues}\r\n graphColors={graphColors}\r\n graphData={graphData}\r\n />\r\n </PdfcnThemeProvider>\r\n );\r\n};\r\n",
+ "content": "import { Badge } from \"@/components/pdf/badge/badge\";\nimport { DataTable } from \"@/components/pdf/data-table/data-table\";\nimport { PdfGraph } from \"@/components/pdf/graph/graph\";\nimport { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PdfList } from \"@/components/pdf/list/list\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { PageNumber } from \"@/components/pdf/page-number/page-number\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n const deliveryOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 31,\n donut: 65,\n \"horizontal-bar\": -2,\n line: -31,\n pie: 0,\n };\n const graphHeight: Record<ReportGraphVariant, number> = {\n area: 191,\n bar: 184,\n donut: 193,\n \"horizontal-bar\": 163,\n line: 195,\n pie: 191,\n };\n const graphOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 0,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n const styles = StyleSheet.create({\n col: {\n flex: 1,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 8,\n width: \"48.6%\",\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n paddingBottom: theme.spacing.page.marginBottom,\n paddingLeft: theme.spacing.page.marginLeft,\n paddingRight: theme.spacing.page.marginRight,\n paddingTop: theme.spacing.page.marginTop,\n position: \"relative\",\n },\n pageBreak: {\n breakAfter: \"page\",\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {data.summary.map((metric) => (\n <View\n key={metric.label}\n style={[\n styles.metricCard,\n {\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n },\n ]}\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n />\n ) : null}\n </View>\n ))}\n </View>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\n <Section\n padding=\"md\"\n noWrap\n style={\n graphVariant === \"horizontal-bar\" ? { marginTop: -6 } : undefined\n }\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Performance Trend\n </Text>\n <View\n style={[\n styles.graphShell,\n {\n marginTop: graphVariant === \"horizontal-bar\" ? 34 : 0,\n position: \"relative\",\n top: graphOffset[graphVariant],\n },\n ]}\n >\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={graphHeight[graphVariant]}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section\n padding=\"md\"\n style={{\n position: \"relative\",\n top: deliveryOffset[graphVariant],\n }}\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n\n <Page size=\"A4\" style={styles.page}>\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Avg Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with pdfcn\"\n rightText={<PageNumber size=\"xs\" />}\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-security/report-layout.tsx"
},
{
"path": "registry/bases/takumi/blocks/report-security/report-security.tsx",
- "content": "import { ReportTemplateFrame } from \"./report-layout\";\r\nimport type { ReportTemplateProps } from \"./report-layout\";\r\nimport type { BaseReportData } from \"./report.types\";\r\n\r\nconst sampleSecurityData: BaseReportData = {\r\n author: \"Security Engineering\",\r\n generatedAt: \"February 23, 2026\",\r\n highlights: [\r\n \"Critical vulnerabilities reduced through mandatory patch windows.\",\r\n \"Secrets rotation remains the highest-risk stream and needs additional staffing.\",\r\n \"External penetration test scheduled for next sprint to validate fixes.\",\r\n ],\r\n period: \"Sprint 05, 2026\",\r\n rows: [\r\n {\r\n label: \"Identity Hardening\",\r\n owner: \"E. Brown\",\r\n progress: 87,\r\n risk: \"Low\",\r\n status: \"On Track\",\r\n },\r\n {\r\n label: \"Secrets Rotation\",\r\n owner: \"P. Nair\",\r\n progress: 58,\r\n risk: \"High\",\r\n status: \"At Risk\",\r\n },\r\n {\r\n label: \"Dependency Scanning\",\r\n owner: \"I. Shah\",\r\n progress: 81,\r\n risk: \"Medium\",\r\n status: \"On Track\",\r\n },\r\n {\r\n label: \"WAF Policy\",\r\n owner: \"S. Reed\",\r\n progress: 76,\r\n risk: \"Low\",\r\n status: \"On Track\",\r\n },\r\n ],\r\n series: [\r\n { label: \"W1\", value: 61 },\r\n { label: \"W2\", value: 63 },\r\n { label: \"W3\", value: 64 },\r\n { label: \"W4\", value: 66 },\r\n { label: \"W5\", value: 67 },\r\n { label: \"W6\", value: 68 },\r\n { label: \"W7\", value: 69 },\r\n { label: \"W8\", value: 71 },\r\n { label: \"W9\", value: 72 },\r\n { label: \"W10\", value: 74 },\r\n { label: \"W11\", value: 76 },\r\n { label: \"W12\", value: 78 },\r\n ],\r\n subtitle: \"Vulnerability trends, control maturity, and remediation health\",\r\n summary: [\r\n {\r\n label: \"Critical Vulns\",\r\n tone: \"success\",\r\n trend: \"-3 from last sprint\",\r\n value: \"2\",\r\n },\r\n { label: \"Patch SLA\", tone: \"success\", trend: \"+5.3 pts\", value: \"92.0%\" },\r\n { label: \"Open Findings\", tone: \"warning\", trend: \"+4\", value: \"41\" },\r\n { label: \"Control Score\", tone: \"info\", trend: \"+2 pts\", value: \"84/100\" },\r\n ],\r\n title: \"Security Posture Report\",\r\n};\r\n\r\nexport const SecurityReportDocument = ({\r\n theme,\r\n data = sampleSecurityData,\r\n}: ReportTemplateProps) => (\r\n <ReportTemplateFrame\r\n theme={theme}\r\n data={data}\r\n titlePrefix=\"Security Report\"\r\n statusLabel=\"Security: Action Needed\"\r\n statusTone=\"destructive\"\r\n graphVariant=\"donut\"\r\n graphTitle=\"Open risk distribution\"\r\n graphSubtitle=\"High/Medium/Low workload share\"\r\n graphLegend=\"right\"\r\n graphShowValues\r\n graphColors={[\"#DC2626\", \"#F59E0B\", \"#16A34A\", \"#0EA5E9\"]}\r\n graphData={[\r\n { label: \"High Risk\", value: 14 },\r\n { label: \"Medium Risk\", value: 17 },\r\n { label: \"Low Risk\", value: 8 },\r\n { label: \"Info\", value: 4 },\r\n ]}\r\n />\r\n);\r\n",
+ "content": "import { ReportTemplateFrame } from \"./report-layout\";\nimport type { ReportTemplateProps } from \"./report-layout\";\nimport type { BaseReportData } from \"./report.types\";\n\nconst sampleSecurityData: BaseReportData = {\n author: \"Security Engineering\",\n generatedAt: \"February 23, 2026\",\n highlights: [\n \"Critical vulnerabilities reduced through mandatory patch windows.\",\n \"Secrets rotation remains the highest-risk stream and needs additional staffing.\",\n \"External penetration test scheduled for next sprint to validate fixes.\",\n ],\n period: \"Sprint 05, 2026\",\n rows: [\n {\n label: \"Identity Hardening\",\n owner: \"E. Brown\",\n progress: 87,\n risk: \"Low\",\n status: \"On Track\",\n },\n {\n label: \"Secrets Rotation\",\n owner: \"P. Nair\",\n progress: 58,\n risk: \"High\",\n status: \"At Risk\",\n },\n {\n label: \"Dependency Scanning\",\n owner: \"I. Shah\",\n progress: 81,\n risk: \"Medium\",\n status: \"On Track\",\n },\n {\n label: \"WAF Policy\",\n owner: \"S. Reed\",\n progress: 76,\n risk: \"Low\",\n status: \"On Track\",\n },\n ],\n series: [\n { label: \"W1\", value: 61 },\n { label: \"W2\", value: 63 },\n { label: \"W3\", value: 64 },\n { label: \"W4\", value: 66 },\n { label: \"W5\", value: 67 },\n { label: \"W6\", value: 68 },\n { label: \"W7\", value: 69 },\n { label: \"W8\", value: 71 },\n { label: \"W9\", value: 72 },\n { label: \"W10\", value: 74 },\n { label: \"W11\", value: 76 },\n { label: \"W12\", value: 78 },\n ],\n subtitle: \"Vulnerability trends, control maturity, and remediation health\",\n summary: [\n {\n label: \"Critical Vulns\",\n tone: \"success\",\n trend: \"-3 from last sprint\",\n value: \"2\",\n },\n { label: \"Patch SLA\", tone: \"success\", trend: \"+5.3 pts\", value: \"92.0%\" },\n { label: \"Open Findings\", tone: \"warning\", trend: \"+4\", value: \"41\" },\n { label: \"Control Score\", tone: \"info\", trend: \"+2 pts\", value: \"84/100\" },\n ],\n title: \"Security Posture Report\",\n};\n\nexport const SecurityReportDocument = ({\n theme,\n data = sampleSecurityData,\n}: ReportTemplateProps) => (\n <ReportTemplateFrame\n theme={theme}\n data={data}\n titlePrefix=\"Security Report\"\n statusLabel=\"Security: Action Needed\"\n statusTone=\"destructive\"\n graphVariant=\"donut\"\n graphTitle=\"Open risk distribution\"\n graphSubtitle=\"High/Medium/Low workload share\"\n graphLegend=\"right\"\n graphShowValues\n graphColors={[\"#DC2626\", \"#F59E0B\", \"#16A34A\", \"#0EA5E9\"]}\n graphData={[\n { label: \"High Risk\", value: 14 },\n { label: \"Medium Risk\", value: 17 },\n { label: \"Low Risk\", value: 8 },\n { label: \"Info\", value: 4 },\n ]}\n />\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-security/report-security.tsx"
},
{
"path": "registry/bases/takumi/blocks/report-security/report.types.ts",
- "content": "export interface SummaryMetric {\r\n label: string;\r\n value: string;\r\n trend?: string;\r\n tone?: \"success\" | \"warning\" | \"destructive\" | \"info\";\r\n}\r\n\r\nexport type ReportRow = Record<string, unknown> & {\r\n label: string;\r\n owner: string;\r\n status: string;\r\n progress: number;\r\n risk?: string;\r\n};\r\n\r\nexport interface ReportSeriesPoint {\r\n label: string;\r\n value: number;\r\n}\r\n\r\nexport interface BaseReportData {\r\n title: string;\r\n subtitle: string;\r\n generatedAt: string;\r\n period: string;\r\n author: string;\r\n summary: SummaryMetric[];\r\n rows: ReportRow[];\r\n series: ReportSeriesPoint[];\r\n highlights: string[];\r\n}\r\n",
+ "content": "export interface SummaryMetric {\n label: string;\n value: string;\n trend?: string;\n tone?: \"success\" | \"warning\" | \"destructive\" | \"info\";\n}\n\nexport type ReportRow = Record<string, unknown> & {\n label: string;\n owner: string;\n status: string;\n progress: number;\n risk?: string;\n};\n\nexport interface ReportSeriesPoint {\n label: string;\n value: number;\n}\n\nexport interface BaseReportData {\n title: string;\n subtitle: string;\n generatedAt: string;\n period: string;\n author: string;\n summary: SummaryMetric[];\n rows: ReportRow[];\n series: ReportSeriesPoint[];\n highlights: string[];\n}\n",
"type": "registry:block",
"target": "components/pdf/blocks/report-security/report.types.ts"
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/section.json b/apps/web/public/r/takumi/section.json
index cc65283..db7499f 100644
--- a/apps/web/public/r/takumi/section.json
+++ b/apps/web/public/r/takumi/section.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/takumi/components/section/section.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport { View, StyleSheet } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type SectionSpacing = \"none\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\r\nexport type SectionPadding = \"none\" | \"sm\" | \"md\" | \"lg\";\r\nexport type SectionVariant = \"default\" | \"callout\" | \"highlight\" | \"card\";\r\n\r\n/**\r\n * Layout container with spacing, padding, and visual style variants.\r\n * Props - `spacing` | `padding` | `background` | `border` | `variant` | `accentColor` | `noWrap` | `children` | `style`\r\n * @see {@link SectionProps}\r\n */\r\nexport interface SectionProps extends PDFComponentProps {\r\n /**\r\n * @default 'md'\r\n */\r\n spacing?: SectionSpacing;\r\n padding?: SectionPadding;\r\n background?: string;\r\n /**\r\n * @default false\r\n */\r\n border?: boolean;\r\n /**\r\n * @default 'default'\r\n */\r\n variant?: SectionVariant;\r\n accentColor?: string;\r\n /**\r\n * @default false\r\n */\r\n noWrap?: boolean;\r\n}\r\n\r\nconst createSectionStyles = (t: PdfcnTheme) => {\r\n const { spacing, borderRadius } = t.primitives;\r\n return StyleSheet.create({\r\n base: { flexDirection: \"column\" },\r\n border: {\r\n borderColor: t.colors.border,\r\n borderRadius: borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: spacing[0.5],\r\n },\r\n callout: {\r\n borderLeftColor: t.colors.primary,\r\n borderLeftStyle: \"solid\",\r\n borderLeftWidth: spacing[1],\r\n paddingLeft: spacing[4],\r\n paddingVertical: spacing[2],\r\n },\r\n card: {\r\n borderColor: t.colors.border,\r\n borderRadius: borderRadius.md,\r\n borderStyle: \"solid\",\r\n borderWidth: spacing[0.5],\r\n padding: spacing[4],\r\n },\r\n highlight: {\r\n backgroundColor: t.colors.muted,\r\n borderLeftColor: t.colors.primary,\r\n borderLeftStyle: \"solid\",\r\n borderLeftWidth: spacing[1],\r\n padding: spacing[4],\r\n },\r\n paddingLg: { padding: spacing[6] },\r\n paddingMd: { padding: spacing[4] },\r\n paddingNone: { padding: spacing[0] },\r\n paddingSm: { padding: spacing[3] },\r\n spacingLg: { marginVertical: spacing[8] },\r\n spacingMd: { marginVertical: t.spacing.sectionGap },\r\n spacingNone: { marginVertical: spacing[0] },\r\n spacingSm: { marginVertical: spacing[4] },\r\n spacingXl: { marginVertical: spacing[12] },\r\n });\r\n};\r\n\r\nexport const Section = ({\r\n spacing = \"md\",\r\n padding,\r\n background,\r\n border,\r\n variant = \"default\",\r\n accentColor,\r\n children,\r\n style,\r\n}: SectionProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createSectionStyles(theme), [theme]);\r\n const spacingMap = {\r\n lg: styles.spacingLg,\r\n md: styles.spacingMd,\r\n none: styles.spacingNone,\r\n sm: styles.spacingSm,\r\n xl: styles.spacingXl,\r\n };\r\n const paddingMap = {\r\n lg: styles.paddingLg,\r\n md: styles.paddingMd,\r\n none: styles.paddingNone,\r\n sm: styles.paddingSm,\r\n };\r\n const variantMap: Record<SectionVariant, Style | null> = {\r\n callout: styles.callout,\r\n card: styles.card,\r\n default: null,\r\n highlight: styles.highlight,\r\n };\r\n const styleArray: Style[] = [styles.base, spacingMap[spacing]];\r\n const variantStyle = variantMap[variant];\r\n if (variantStyle) {\r\n styleArray.push(variantStyle);\r\n }\r\n if (accentColor && (variant === \"callout\" || variant === \"highlight\")) {\r\n styleArray.push({\r\n borderLeftColor: resolveColor(accentColor, theme.colors),\r\n });\r\n }\r\n if (padding && padding in paddingMap) {\r\n styleArray.push(paddingMap[padding]);\r\n }\r\n if (border && variant === \"default\") {\r\n styleArray.push(styles.border);\r\n }\r\n if (background) {\r\n styleArray.push({\r\n backgroundColor: resolveColor(background, theme.colors),\r\n });\r\n }\r\n if (style) {\r\n styleArray.push(...[style].flat());\r\n }\r\n return <View style={styleArray}>{children}</View>;\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport { View, StyleSheet } from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type SectionSpacing = \"none\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type SectionPadding = \"none\" | \"sm\" | \"md\" | \"lg\";\nexport type SectionVariant = \"default\" | \"callout\" | \"highlight\" | \"card\";\n\n/**\n * Layout container with spacing, padding, and visual style variants.\n * Props - `spacing` | `padding` | `background` | `border` | `variant` | `accentColor` | `noWrap` | `children` | `style`\n * @see {@link SectionProps}\n */\nexport interface SectionProps extends PDFComponentProps {\n /**\n * @default 'md'\n */\n spacing?: SectionSpacing;\n padding?: SectionPadding;\n background?: string;\n /**\n * @default false\n */\n border?: boolean;\n /**\n * @default 'default'\n */\n variant?: SectionVariant;\n accentColor?: string;\n /**\n * @default false\n */\n noWrap?: boolean;\n}\n\nconst createSectionStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius } = t.primitives;\n return StyleSheet.create({\n base: { flexDirection: \"column\" },\n border: {\n borderColor: t.colors.border,\n borderRadius: borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: spacing[0.5],\n },\n callout: {\n borderLeftColor: t.colors.primary,\n borderLeftStyle: \"solid\",\n borderLeftWidth: spacing[1],\n paddingLeft: spacing[4],\n paddingVertical: spacing[2],\n },\n card: {\n borderColor: t.colors.border,\n borderRadius: borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: spacing[0.5],\n padding: spacing[4],\n },\n highlight: {\n backgroundColor: t.colors.muted,\n borderLeftColor: t.colors.primary,\n borderLeftStyle: \"solid\",\n borderLeftWidth: spacing[1],\n padding: spacing[4],\n },\n paddingLg: { padding: spacing[6] },\n paddingMd: { padding: spacing[4] },\n paddingNone: { padding: spacing[0] },\n paddingSm: { padding: spacing[3] },\n spacingLg: { marginVertical: spacing[8] },\n spacingMd: { marginVertical: t.spacing.sectionGap },\n spacingNone: { marginVertical: spacing[0] },\n spacingSm: { marginVertical: spacing[4] },\n spacingXl: { marginVertical: spacing[12] },\n });\n};\n\nexport const Section = ({\n spacing = \"md\",\n padding,\n background,\n border,\n variant = \"default\",\n accentColor,\n children,\n style,\n}: SectionProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createSectionStyles(theme), [theme]);\n const spacingMap = {\n lg: styles.spacingLg,\n md: styles.spacingMd,\n none: styles.spacingNone,\n sm: styles.spacingSm,\n xl: styles.spacingXl,\n };\n const paddingMap = {\n lg: styles.paddingLg,\n md: styles.paddingMd,\n none: styles.paddingNone,\n sm: styles.paddingSm,\n };\n const variantMap: Record<SectionVariant, Style | null> = {\n callout: styles.callout,\n card: styles.card,\n default: null,\n highlight: styles.highlight,\n };\n const styleArray: Style[] = [styles.base, spacingMap[spacing]];\n const variantStyle = variantMap[variant];\n if (variantStyle) {\n styleArray.push(variantStyle);\n }\n if (accentColor && (variant === \"callout\" || variant === \"highlight\")) {\n styleArray.push({\n borderLeftColor: resolveColor(accentColor, theme.colors),\n });\n }\n if (padding && padding in paddingMap) {\n styleArray.push(paddingMap[padding]);\n }\n if (border && variant === \"default\") {\n styleArray.push(styles.border);\n }\n if (background) {\n styleArray.push({\n backgroundColor: resolveColor(background, theme.colors),\n });\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return <View style={styleArray}>{children}</View>;\n};\n",
"type": "registry:component",
"target": "components/pdf/section/section.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/shipping-label.json b/apps/web/public/r/takumi/shipping-label.json
index ad6945e..368766a 100644
--- a/apps/web/public/r/takumi/shipping-label.json
+++ b/apps/web/public/r/takumi/shipping-label.json
@@ -17,7 +17,7 @@
"files": [
{
"path": "registry/bases/takumi/blocks/shipping-label/shipping-label.tsx",
- "content": "import { PdfImage } from \"@/registry/bases/takumi/components/pdf-image/pdf-image\";\nimport { PdfQRCode } from \"@/registry/bases/takumi/components/qrcode/qrcode\";\nimport { Text } from \"@/registry/bases/takumi/components/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type {\n ShippingLabelAddress,\n ShippingLabelData,\n} from \"./shipping-label.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: ShippingLabelData = {\n carrier: \"UPS\",\n dimensions: '12\" x 8\" x 6\"',\n from: {\n address: \"456 Industrial Blvd\",\n city: \"Los Angeles\",\n country: \"USA\",\n name: \"ACME Corporation\",\n state: \"CA\",\n zip: \"90001\",\n },\n handlingLabels: [\"FRAGILE\", \"THIS SIDE UP\"],\n packageCount: 1,\n postage: \"$18.40\",\n serviceLevel: \"Ground\",\n to: {\n address: \"123 Main Street, Apt 4B\",\n city: \"New York\",\n country: \"USA\",\n name: \"John Doe\",\n phone: \"(503) 555-0142\",\n state: \"NY\",\n zip: \"10001\",\n },\n trackingNumber: \"TRACK123456789US\",\n weight: \"2.5 kg\",\n};\n\n// Standard 4\" x 6\" shipping label, expressed in PDF points (72 dpi)\nconst LABEL_SIZE = { height: 432, width: 288 };\n\nconst formatCityLine = (party: ShippingLabelAddress) => {\n const cityStateZip = `${party.city}, ${party.state} ${party.zip}`;\n return party.country ? `${cityStateZip}, ${party.country}` : cityStateZip;\n};\n\nconst formatStreetLine = (party: ShippingLabelAddress) => party.address;\n\n// Shared address block — same treatment for both parties (10pt, bold name)\nconst AddressLines = ({\n party,\n}: {\n party: ShippingLabelAddress & { phone?: string };\n}) => (\n <>\n <Text noMargin variant=\"xs\" weight=\"bold\">\n {party.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {formatStreetLine(party)}\n </Text>\n <Text noMargin variant=\"xs\">\n {formatCityLine(party)}\n </Text>\n {party.phone && (\n <Text noMargin variant=\"xs\" color=\"mutedForeground\">\n {party.phone}\n </Text>\n )}\n </>\n);\n\nconst ShippingLabelContent = ({ data }: { data: ShippingLabelData }) => {\n const theme = usePdfcnTheme();\n\n const accent = resolveColor(\n data.accentColor ?? theme.colors.primary,\n theme.colors\n );\n\n const detailRows = [\n ...(data.weight ? [{ key: \"Weight\", value: data.weight }] : []),\n ...(data.dimensions ? [{ key: \"Dimensions\", value: data.dimensions }] : []),\n ...(typeof data.packageCount === \"number\"\n ? [{ key: \"Packages\", value: `${data.packageCount}` }]\n : []),\n { key: \"Postage\", value: data.postage ?? \"PAID\" },\n ];\n\n const styles = StyleSheet.create({\n addresses: { flex: 1, flexDirection: \"row\" },\n badgesRow: {\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 6,\n marginTop: 8,\n },\n barcodeArea: { alignItems: \"center\", marginTop: 10 },\n carrierName: { fontSize: 16, fontWeight: \"bold\" },\n fromColumn: { flex: 1, paddingLeft: 12 },\n handlingTag: {\n alignItems: \"center\",\n backgroundColor: theme.colors.foreground,\n justifyContent: \"center\",\n paddingHorizontal: 8,\n paddingVertical: 4,\n },\n handlingTagText: {\n color: theme.colors.background,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 1,\n textTransform: \"uppercase\",\n },\n headerRow: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n },\n label: {\n borderColor: theme.colors.foreground,\n borderStyle: \"solid\",\n borderWidth: 2,\n flex: 1,\n padding: 10,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n flexDirection: \"column\",\n height: LABEL_SIZE.height,\n overflow: \"hidden\",\n padding: 8,\n width: LABEL_SIZE.width,\n },\n rule: {\n backgroundColor: theme.colors.foreground,\n height: 2,\n marginVertical: 6,\n },\n sectionLabel: {\n color: accent,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 1,\n marginBottom: 4,\n textTransform: \"uppercase\",\n },\n serviceRight: { alignItems: \"flex-end\" },\n shipToColumn: {\n borderRightColor: theme.colors.foreground,\n borderRightStyle: \"solid\",\n borderRightWidth: 2,\n flex: 1.4,\n paddingRight: 12,\n },\n table: {\n borderColor: theme.colors.foreground,\n borderStyle: \"solid\",\n borderWidth: 2,\n },\n tableKey: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.5,\n textTransform: \"uppercase\",\n width: 84,\n },\n tableRow: {\n alignItems: \"center\",\n borderBottomColor: theme.colors.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n flexDirection: \"row\",\n paddingHorizontal: 8,\n paddingVertical: 3,\n },\n tableRowLast: {\n alignItems: \"center\",\n flexDirection: \"row\",\n paddingHorizontal: 8,\n paddingVertical: 3,\n },\n tableValue: { flex: 1 },\n trackingText: {\n fontWeight: \"bold\",\n letterSpacing: 2,\n marginTop: 6,\n textTransform: \"uppercase\",\n },\n });\n\n return (\n <Document title={`Shipping Label ${data.trackingNumber}`}>\n <Page size={LABEL_SIZE} style={styles.page}>\n <View style={styles.label}>\n <View style={styles.headerRow}>\n <Text noMargin style={styles.carrierName}>\n {data.carrier}\n </Text>\n <View style={styles.serviceRight}>\n <Text noMargin style={styles.sectionLabel}>\n {data.serviceLevel}\n </Text>\n </View>\n </View>\n\n <View style={styles.rule} />\n\n <View style={styles.addresses}>\n <View style={styles.shipToColumn}>\n <Text noMargin style={styles.sectionLabel}>\n Ship To\n </Text>\n <AddressLines party={data.to} />\n </View>\n <View style={styles.fromColumn}>\n <Text noMargin style={styles.sectionLabel}>\n From\n </Text>\n <AddressLines party={data.from} />\n </View>\n </View>\n\n <View style={styles.rule} />\n\n <View style={styles.table}>\n {detailRows.map((row, index) => (\n <View\n key={row.key}\n style={\n index === detailRows.length - 1\n ? styles.tableRowLast\n : styles.tableRow\n }\n >\n <Text noMargin style={styles.tableKey}>\n {row.key}\n </Text>\n <Text noMargin style={styles.tableValue} variant=\"xs\">\n {row.value}\n </Text>\n </View>\n ))}\n </View>\n\n {data.handlingLabels && data.handlingLabels.length > 0 && (\n <View style={styles.badgesRow}>\n {data.handlingLabels.map((label, index) => (\n <View key={`${label}-${index}`} style={styles.handlingTag}>\n <Text noMargin style={styles.handlingTagText}>\n {label}\n </Text>\n </View>\n ))}\n </View>\n )}\n\n <View style={styles.barcodeArea}>\n {data.barcodeUrl ? (\n <PdfImage\n fit=\"contain\"\n height={72}\n src={data.barcodeUrl}\n width=\"100%\"\n />\n ) : (\n <PdfQRCode\n backgroundColor=\"#ffffff\"\n color=\"#000000\"\n size={80}\n value={data.trackingNumber}\n />\n )}\n <Text\n noMargin\n style={styles.trackingText}\n variant=\"xs\"\n weight=\"bold\"\n >\n {data.trackingNumber}\n </Text>\n </View>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const ShippingLabelDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: ShippingLabelData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <ShippingLabelContent data={data} />\n </PdfcnThemeProvider>\n);\n",
+ "content": "import { PdfImage } from \"@/components/pdf/pdf-image/pdf-image\";\nimport { PdfQRCode } from \"@/components/pdf/qrcode/qrcode\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type {\n ShippingLabelAddress,\n ShippingLabelData,\n} from \"./shipping-label.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: ShippingLabelData = {\n carrier: \"UPS\",\n dimensions: '12\" x 8\" x 6\"',\n from: {\n address: \"456 Industrial Blvd\",\n city: \"Los Angeles\",\n country: \"USA\",\n name: \"ACME Corporation\",\n state: \"CA\",\n zip: \"90001\",\n },\n handlingLabels: [\"FRAGILE\", \"THIS SIDE UP\"],\n packageCount: 1,\n postage: \"$18.40\",\n serviceLevel: \"Ground\",\n to: {\n address: \"123 Main Street, Apt 4B\",\n city: \"New York\",\n country: \"USA\",\n name: \"John Doe\",\n phone: \"(503) 555-0142\",\n state: \"NY\",\n zip: \"10001\",\n },\n trackingNumber: \"TRACK123456789US\",\n weight: \"2.5 kg\",\n};\n\n// Standard 4\" x 6\" shipping label, expressed in PDF points (72 dpi)\nconst LABEL_SIZE = { height: 432, width: 288 };\n\nconst formatCityLine = (party: ShippingLabelAddress) => {\n const cityStateZip = `${party.city}, ${party.state} ${party.zip}`;\n return party.country ? `${cityStateZip}, ${party.country}` : cityStateZip;\n};\n\nconst formatStreetLine = (party: ShippingLabelAddress) => party.address;\n\n// Shared address block — same treatment for both parties (10pt, bold name)\nconst AddressLines = ({\n party,\n}: {\n party: ShippingLabelAddress & { phone?: string };\n}) => (\n <>\n <Text noMargin variant=\"xs\" weight=\"bold\">\n {party.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {formatStreetLine(party)}\n </Text>\n <Text noMargin variant=\"xs\">\n {formatCityLine(party)}\n </Text>\n {party.phone && (\n <Text noMargin variant=\"xs\" color=\"mutedForeground\">\n {party.phone}\n </Text>\n )}\n </>\n);\n\nconst ShippingLabelContent = ({ data }: { data: ShippingLabelData }) => {\n const theme = usePdfcnTheme();\n\n const accent = resolveColor(\n data.accentColor ?? theme.colors.primary,\n theme.colors\n );\n\n const detailRows = [\n ...(data.weight ? [{ key: \"Weight\", value: data.weight }] : []),\n ...(data.dimensions ? [{ key: \"Dimensions\", value: data.dimensions }] : []),\n ...(typeof data.packageCount === \"number\"\n ? [{ key: \"Packages\", value: `${data.packageCount}` }]\n : []),\n { key: \"Postage\", value: data.postage ?? \"PAID\" },\n ];\n\n const styles = StyleSheet.create({\n addresses: { flex: 1, flexDirection: \"row\" },\n badgesRow: {\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 6,\n marginTop: 8,\n },\n barcodeArea: { alignItems: \"center\", marginTop: 10 },\n carrierName: { fontSize: 16, fontWeight: \"bold\" },\n fromColumn: { flex: 1, paddingLeft: 12 },\n handlingTag: {\n alignItems: \"center\",\n backgroundColor: theme.colors.foreground,\n justifyContent: \"center\",\n paddingHorizontal: 8,\n paddingVertical: 4,\n },\n handlingTagText: {\n color: theme.colors.background,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 1,\n textTransform: \"uppercase\",\n },\n headerRow: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n },\n label: {\n borderColor: theme.colors.foreground,\n borderStyle: \"solid\",\n borderWidth: 2,\n flex: 1,\n padding: 10,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n flexDirection: \"column\",\n height: LABEL_SIZE.height,\n overflow: \"hidden\",\n padding: 8,\n width: LABEL_SIZE.width,\n },\n rule: {\n backgroundColor: theme.colors.foreground,\n height: 2,\n marginVertical: 6,\n },\n sectionLabel: {\n color: accent,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 1,\n marginBottom: 4,\n textTransform: \"uppercase\",\n },\n serviceRight: { alignItems: \"flex-end\" },\n shipToColumn: {\n borderRightColor: theme.colors.foreground,\n borderRightStyle: \"solid\",\n borderRightWidth: 2,\n flex: 1.4,\n paddingRight: 12,\n },\n table: {\n borderColor: theme.colors.foreground,\n borderStyle: \"solid\",\n borderWidth: 2,\n },\n tableKey: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.5,\n textTransform: \"uppercase\",\n width: 84,\n },\n tableRow: {\n alignItems: \"center\",\n borderBottomColor: theme.colors.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n flexDirection: \"row\",\n paddingHorizontal: 8,\n paddingVertical: 3,\n },\n tableRowLast: {\n alignItems: \"center\",\n flexDirection: \"row\",\n paddingHorizontal: 8,\n paddingVertical: 3,\n },\n tableValue: { flex: 1 },\n trackingText: {\n fontWeight: \"bold\",\n letterSpacing: 2,\n marginTop: 6,\n textTransform: \"uppercase\",\n },\n });\n\n return (\n <Document title={`Shipping Label ${data.trackingNumber}`}>\n <Page size={LABEL_SIZE} style={styles.page}>\n <View style={styles.label}>\n <View style={styles.headerRow}>\n <Text noMargin style={styles.carrierName}>\n {data.carrier}\n </Text>\n <View style={styles.serviceRight}>\n <Text noMargin style={styles.sectionLabel}>\n {data.serviceLevel}\n </Text>\n </View>\n </View>\n\n <View style={styles.rule} />\n\n <View style={styles.addresses}>\n <View style={styles.shipToColumn}>\n <Text noMargin style={styles.sectionLabel}>\n Ship To\n </Text>\n <AddressLines party={data.to} />\n </View>\n <View style={styles.fromColumn}>\n <Text noMargin style={styles.sectionLabel}>\n From\n </Text>\n <AddressLines party={data.from} />\n </View>\n </View>\n\n <View style={styles.rule} />\n\n <View style={styles.table}>\n {detailRows.map((row, index) => (\n <View\n key={row.key}\n style={\n index === detailRows.length - 1\n ? styles.tableRowLast\n : styles.tableRow\n }\n >\n <Text noMargin style={styles.tableKey}>\n {row.key}\n </Text>\n <Text noMargin style={styles.tableValue} variant=\"xs\">\n {row.value}\n </Text>\n </View>\n ))}\n </View>\n\n {data.handlingLabels && data.handlingLabels.length > 0 && (\n <View style={styles.badgesRow}>\n {data.handlingLabels.map((label, index) => (\n <View key={`${label}-${index}`} style={styles.handlingTag}>\n <Text noMargin style={styles.handlingTagText}>\n {label}\n </Text>\n </View>\n ))}\n </View>\n )}\n\n <View style={styles.barcodeArea}>\n {data.barcodeUrl ? (\n <PdfImage\n fit=\"contain\"\n height={72}\n src={data.barcodeUrl}\n width=\"100%\"\n />\n ) : (\n <PdfQRCode\n backgroundColor=\"#ffffff\"\n color=\"#000000\"\n size={80}\n value={data.trackingNumber}\n />\n )}\n <Text\n noMargin\n style={styles.trackingText}\n variant=\"xs\"\n weight=\"bold\"\n >\n {data.trackingNumber}\n </Text>\n </View>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const ShippingLabelDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: ShippingLabelData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <ShippingLabelContent data={data} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/shipping-label/shipping-label.tsx"
},
@@ -29,4 +29,4 @@
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/signature.json b/apps/web/public/r/takumi/signature.json
index a913cb6..674d4fe 100644
--- a/apps/web/public/r/takumi/signature.json
+++ b/apps/web/public/r/takumi/signature.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/takumi/components/signature/signature.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n Text as PDFText,\r\n StyleSheet,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type SignatureVariant = \"single\" | \"double\" | \"inline\";\r\n\r\n/**\r\n * Signature signer properties.\r\n * Props - `label` | `name` | `title` | `date`\r\n * @see {@link SignatureSigner}\r\n */\r\nexport interface SignatureSigner {\r\n label?: string;\r\n name?: string;\r\n title?: string;\r\n date?: string;\r\n}\r\n\r\n/**\r\n * Signature block properties.\r\n * Props - `variant` | `label` | `name` | `title` | `date` | `signers` | `style`\r\n * @see {@link PdfSignatureBlockProps}\r\n */\r\nexport interface PdfSignatureBlockProps {\r\n /**\r\n * Layout variant: [single, double, inline]\r\n * @default 'single'\r\n */\r\n variant?: SignatureVariant;\r\n label?: string;\r\n name?: string;\r\n title?: string;\r\n date?: string;\r\n signers?: [SignatureSigner, SignatureSigner];\r\n style?: Style;\r\n}\r\n\r\nconst createSignatureStyles = (t: PdfcnTheme) => {\r\n const { spacing, fontWeights, typography } = t.primitives;\r\n return StyleSheet.create({\r\n block: { flex: 1, minWidth: 140 },\r\n container: {\r\n marginBottom: t.spacing.componentGap,\r\n marginTop: t.spacing.sectionGap,\r\n },\r\n dateText: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.xs,\r\n marginTop: 1,\r\n },\r\n doubleRow: {\r\n flexDirection: \"row\",\r\n gap: spacing[8],\r\n justifyContent: \"space-between\",\r\n },\r\n inlineLabel: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.sm,\r\n },\r\n inlineLine: {\r\n borderBottomColor: t.colors.foreground,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: 1,\r\n height: spacing[5],\r\n minWidth: 120,\r\n paddingHorizontal: spacing[2],\r\n },\r\n inlineName: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n },\r\n inlineRow: {\r\n alignItems: \"center\",\r\n flexDirection: \"row\",\r\n flexWrap: \"wrap\",\r\n gap: spacing[3],\r\n },\r\n label: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.sm,\r\n marginBottom: spacing[1],\r\n },\r\n line: {\r\n borderBottomColor: t.colors.foreground,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: 1,\r\n marginBottom: spacing[1],\r\n minHeight: spacing[6],\r\n },\r\n name: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n fontWeight: fontWeights.semibold,\r\n },\r\n titleText: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.sm,\r\n },\r\n });\r\n};\r\n\r\nconst renderSignerBlock = (\r\n signer: SignatureSigner,\r\n styles: ReturnType<typeof createSignatureStyles>\r\n) => (\r\n <View style={styles.block}>\r\n {signer.label ? (\r\n <PDFText style={styles.label}>{signer.label}</PDFText>\r\n ) : null}\r\n <View style={styles.line} />\r\n {signer.name ? <PDFText style={styles.name}>{signer.name}</PDFText> : null}\r\n {signer.title ? (\r\n <PDFText style={styles.titleText}>{signer.title}</PDFText>\r\n ) : null}\r\n {signer.date ? (\r\n <PDFText style={styles.dateText}>{signer.date}</PDFText>\r\n ) : null}\r\n </View>\r\n);\r\n\r\nexport const PdfSignatureBlock = ({\r\n variant = \"single\",\r\n label = \"Signature\",\r\n name,\r\n title,\r\n date,\r\n signers,\r\n style,\r\n}: PdfSignatureBlockProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createSignatureStyles(theme), [theme]);\r\n const containerStyles: Style[] = [styles.container];\r\n if (style) {\r\n containerStyles.push(style);\r\n }\r\n\r\n if (variant === \"inline\") {\r\n return (\r\n <View\r\n style={[{ breakInside: \"avoid\" as const }, containerStyles]\r\n .flat()\r\n .filter(Boolean)}\r\n >\r\n <View style={styles.inlineRow}>\r\n <PDFText style={styles.inlineLabel}>{`${label}:`}</PDFText>\r\n <View style={styles.inlineLine} />\r\n {name ? <PDFText style={styles.inlineName}>{name}</PDFText> : null}\r\n </View>\r\n </View>\r\n );\r\n }\r\n\r\n if (variant === \"double\") {\r\n const [first, second] = signers ?? [\r\n { date: \"\", label: \"Authorized by\", name: \"\", title: \"\" },\r\n { date: \"\", label: \"Approved by\", name: \"\", title: \"\" },\r\n ];\r\n return (\r\n <View\r\n style={[{ breakInside: \"avoid\" as const }, containerStyles]\r\n .flat()\r\n .filter(Boolean)}\r\n >\r\n <View style={styles.doubleRow}>\r\n {renderSignerBlock(first, styles)}\r\n {renderSignerBlock(second, styles)}\r\n </View>\r\n </View>\r\n );\r\n }\r\n\r\n return (\r\n <View\r\n style={[{ breakInside: \"avoid\" as const }, containerStyles]\r\n .flat()\r\n .filter(Boolean)}\r\n >\r\n {renderSignerBlock({ date, label, name, title }, styles)}\r\n </View>\r\n );\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type SignatureVariant = \"single\" | \"double\" | \"inline\";\n\n/**\n * Signature signer properties.\n * Props - `label` | `name` | `title` | `date`\n * @see {@link SignatureSigner}\n */\nexport interface SignatureSigner {\n label?: string;\n name?: string;\n title?: string;\n date?: string;\n}\n\n/**\n * Signature block properties.\n * Props - `variant` | `label` | `name` | `title` | `date` | `signers` | `style`\n * @see {@link PdfSignatureBlockProps}\n */\nexport interface PdfSignatureBlockProps {\n /**\n * Layout variant: [single, double, inline]\n * @default 'single'\n */\n variant?: SignatureVariant;\n label?: string;\n name?: string;\n title?: string;\n date?: string;\n signers?: [SignatureSigner, SignatureSigner];\n style?: Style;\n}\n\nconst createSignatureStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights, typography } = t.primitives;\n return StyleSheet.create({\n block: { flex: 1, minWidth: 140 },\n container: {\n marginBottom: t.spacing.componentGap,\n marginTop: t.spacing.sectionGap,\n },\n dateText: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n marginTop: 1,\n },\n doubleRow: {\n flexDirection: \"row\",\n gap: spacing[8],\n justifyContent: \"space-between\",\n },\n inlineLabel: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n },\n inlineLine: {\n borderBottomColor: t.colors.foreground,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n height: spacing[5],\n minWidth: 120,\n paddingHorizontal: spacing[2],\n },\n inlineName: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n },\n inlineRow: {\n alignItems: \"center\",\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: spacing[3],\n },\n label: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n marginBottom: spacing[1],\n },\n line: {\n borderBottomColor: t.colors.foreground,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n marginBottom: spacing[1],\n minHeight: spacing[6],\n },\n name: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n },\n titleText: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n },\n });\n};\n\nconst renderSignerBlock = (\n signer: SignatureSigner,\n styles: ReturnType<typeof createSignatureStyles>\n) => (\n <View style={styles.block}>\n {signer.label ? (\n <PDFText style={styles.label}>{signer.label}</PDFText>\n ) : null}\n <View style={styles.line} />\n {signer.name ? <PDFText style={styles.name}>{signer.name}</PDFText> : null}\n {signer.title ? (\n <PDFText style={styles.titleText}>{signer.title}</PDFText>\n ) : null}\n {signer.date ? (\n <PDFText style={styles.dateText}>{signer.date}</PDFText>\n ) : null}\n </View>\n);\n\nexport const PdfSignatureBlock = ({\n variant = \"single\",\n label = \"Signature\",\n name,\n title,\n date,\n signers,\n style,\n}: PdfSignatureBlockProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createSignatureStyles(theme), [theme]);\n const containerStyles: Style[] = [styles.container];\n if (style) {\n containerStyles.push(style);\n }\n\n if (variant === \"inline\") {\n return (\n <View\n style={[{ breakInside: \"avoid\" as const }, containerStyles]\n .flat()\n .filter(Boolean)}\n >\n <View style={styles.inlineRow}>\n <PDFText style={styles.inlineLabel}>{`${label}:`}</PDFText>\n <View style={styles.inlineLine} />\n {name ? <PDFText style={styles.inlineName}>{name}</PDFText> : null}\n </View>\n </View>\n );\n }\n\n if (variant === \"double\") {\n const [first, second] = signers ?? [\n { date: \"\", label: \"Authorized by\", name: \"\", title: \"\" },\n { date: \"\", label: \"Approved by\", name: \"\", title: \"\" },\n ];\n return (\n <View\n style={[{ breakInside: \"avoid\" as const }, containerStyles]\n .flat()\n .filter(Boolean)}\n >\n <View style={styles.doubleRow}>\n {renderSignerBlock(first, styles)}\n {renderSignerBlock(second, styles)}\n </View>\n </View>\n );\n }\n\n return (\n <View\n style={[{ breakInside: \"avoid\" as const }, containerStyles]\n .flat()\n .filter(Boolean)}\n >\n {renderSignerBlock({ date, label, name, title }, styles)}\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/signature/signature.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/stack.json b/apps/web/public/r/takumi/stack.json
index ae0f590..77f1862 100644
--- a/apps/web/public/r/takumi/stack.json
+++ b/apps/web/public/r/takumi/stack.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/takumi/components/stack/stack.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport { View, StyleSheet } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type StackGap = \"none\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\r\nexport type StackDirection = \"vertical\" | \"horizontal\";\r\nexport type StackAlign = \"start\" | \"center\" | \"end\" | \"stretch\";\r\nexport type StackJustify = \"start\" | \"center\" | \"end\" | \"between\" | \"around\";\r\n\r\n/**\r\n * Flex layout container with gap and direction control.\r\n * Props - `gap` | `direction` | `align` | `justify` | `wrap` | `noWrap` | `children` | `style`\r\n * @see {@link StackProps}\r\n */\r\nexport interface StackProps extends PDFComponentProps {\r\n /**\r\n * @default 'md'\r\n */\r\n gap?: StackGap;\r\n /**\r\n * @default 'vertical'\r\n */\r\n direction?: StackDirection;\r\n /**\r\n * @default 'start'\r\n */\r\n align?: StackAlign;\r\n /**\r\n * @default 'start'\r\n */\r\n justify?: StackJustify;\r\n /**\r\n * @default false\r\n */\r\n wrap?: boolean;\r\n /**\r\n * @default false\r\n */\r\n noWrap?: boolean;\r\n}\r\n\r\nconst createStackStyles = (t: PdfcnTheme) => {\r\n const { spacing } = t.primitives;\r\n return StyleSheet.create({\r\n alignCenter: { alignItems: \"center\" },\r\n alignEnd: { alignItems: \"flex-end\" },\r\n alignStart: { alignItems: \"flex-start\" },\r\n alignStretch: { alignItems: \"stretch\" },\r\n gapLg: { gap: spacing[6] },\r\n gapMd: { gap: spacing[4] },\r\n gapNone: { gap: spacing[0] },\r\n gapSm: { gap: spacing[2] },\r\n gapXl: { gap: spacing[8] },\r\n horizontal: { flexDirection: \"row\" },\r\n justifyAround: { justifyContent: \"space-around\" },\r\n justifyBetween: { justifyContent: \"space-between\" },\r\n justifyCenter: { justifyContent: \"center\" },\r\n justifyEnd: { justifyContent: \"flex-end\" },\r\n justifyStart: { justifyContent: \"flex-start\" },\r\n vertical: { flexDirection: \"column\" },\r\n wrap: { flexWrap: \"wrap\" },\r\n });\r\n};\r\n\r\nexport const Stack = ({\r\n gap = \"md\",\r\n direction = \"vertical\",\r\n align,\r\n justify,\r\n wrap,\r\n children,\r\n style,\r\n}: StackProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createStackStyles(theme), [theme]);\r\n const gapMap = {\r\n lg: styles.gapLg,\r\n md: styles.gapMd,\r\n none: styles.gapNone,\r\n sm: styles.gapSm,\r\n xl: styles.gapXl,\r\n };\r\n const alignMap = {\r\n center: styles.alignCenter,\r\n end: styles.alignEnd,\r\n start: styles.alignStart,\r\n stretch: styles.alignStretch,\r\n };\r\n const justifyMap = {\r\n around: styles.justifyAround,\r\n between: styles.justifyBetween,\r\n center: styles.justifyCenter,\r\n end: styles.justifyEnd,\r\n start: styles.justifyStart,\r\n };\r\n const styleArray: Style[] = [\r\n direction === \"horizontal\" ? styles.horizontal : styles.vertical,\r\n gapMap[gap],\r\n ];\r\n if (align && align in alignMap) {\r\n styleArray.push(alignMap[align]);\r\n }\r\n if (justify && justify in justifyMap) {\r\n styleArray.push(justifyMap[justify]);\r\n }\r\n if (wrap) {\r\n styleArray.push(styles.wrap);\r\n }\r\n if (style) {\r\n styleArray.push(...[style].flat());\r\n }\r\n return <View style={styleArray}>{children}</View>;\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport { View, StyleSheet } from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type StackGap = \"none\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type StackDirection = \"vertical\" | \"horizontal\";\nexport type StackAlign = \"start\" | \"center\" | \"end\" | \"stretch\";\nexport type StackJustify = \"start\" | \"center\" | \"end\" | \"between\" | \"around\";\n\n/**\n * Flex layout container with gap and direction control.\n * Props - `gap` | `direction` | `align` | `justify` | `wrap` | `noWrap` | `children` | `style`\n * @see {@link StackProps}\n */\nexport interface StackProps extends PDFComponentProps {\n /**\n * @default 'md'\n */\n gap?: StackGap;\n /**\n * @default 'vertical'\n */\n direction?: StackDirection;\n /**\n * @default 'start'\n */\n align?: StackAlign;\n /**\n * @default 'start'\n */\n justify?: StackJustify;\n /**\n * @default false\n */\n wrap?: boolean;\n /**\n * @default false\n */\n noWrap?: boolean;\n}\n\nconst createStackStyles = (t: PdfcnTheme) => {\n const { spacing } = t.primitives;\n return StyleSheet.create({\n alignCenter: { alignItems: \"center\" },\n alignEnd: { alignItems: \"flex-end\" },\n alignStart: { alignItems: \"flex-start\" },\n alignStretch: { alignItems: \"stretch\" },\n gapLg: { gap: spacing[6] },\n gapMd: { gap: spacing[4] },\n gapNone: { gap: spacing[0] },\n gapSm: { gap: spacing[2] },\n gapXl: { gap: spacing[8] },\n horizontal: { flexDirection: \"row\" },\n justifyAround: { justifyContent: \"space-around\" },\n justifyBetween: { justifyContent: \"space-between\" },\n justifyCenter: { justifyContent: \"center\" },\n justifyEnd: { justifyContent: \"flex-end\" },\n justifyStart: { justifyContent: \"flex-start\" },\n vertical: { flexDirection: \"column\" },\n wrap: { flexWrap: \"wrap\" },\n });\n};\n\nexport const Stack = ({\n gap = \"md\",\n direction = \"vertical\",\n align,\n justify,\n wrap,\n children,\n style,\n}: StackProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createStackStyles(theme), [theme]);\n const gapMap = {\n lg: styles.gapLg,\n md: styles.gapMd,\n none: styles.gapNone,\n sm: styles.gapSm,\n xl: styles.gapXl,\n };\n const alignMap = {\n center: styles.alignCenter,\n end: styles.alignEnd,\n start: styles.alignStart,\n stretch: styles.alignStretch,\n };\n const justifyMap = {\n around: styles.justifyAround,\n between: styles.justifyBetween,\n center: styles.justifyCenter,\n end: styles.justifyEnd,\n start: styles.justifyStart,\n };\n const styleArray: Style[] = [\n direction === \"horizontal\" ? styles.horizontal : styles.vertical,\n gapMap[gap],\n ];\n if (align && align in alignMap) {\n styleArray.push(alignMap[align]);\n }\n if (justify && justify in justifyMap) {\n styleArray.push(justifyMap[justify]);\n }\n if (wrap) {\n styleArray.push(styles.wrap);\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return <View style={styleArray}>{children}</View>;\n};\n",
"type": "registry:component",
"target": "components/pdf/stack/stack.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/table.json b/apps/web/public/r/takumi/table.json
index eba6f95..b0243e0 100644
--- a/apps/web/public/r/takumi/table.json
+++ b/apps/web/public/r/takumi/table.json
@@ -13,22 +13,22 @@
"files": [
{
"path": "registry/bases/takumi/components/table/table.styles.ts",
- "content": "import { StyleSheet } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\n/**\r\n * Creates all table styles derived from the active theme.\r\n * @param t - The resolved PdfcnTheme instance.\r\n */\r\nexport const createTableStyles = (t: PdfcnTheme) => {\r\n const { spacing, borderRadius, fontWeights, typography } = t.primitives;\r\n const borderColor = t.colors.border;\r\n\r\n const hairline = 0.5;\r\n const rule = 1;\r\n const thick = 1.5;\r\n\r\n const cellPadV = spacing[2] - 2;\r\n const cellPadH = spacing[2] + 2;\r\n // eslint-disable-next-line prefer-destructuring\r\n const cellPadVCompact = spacing[0.5];\r\n // eslint-disable-next-line prefer-destructuring\r\n const cellPadHCompact = spacing[2];\r\n\r\n const rowDivider = {\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\" as const,\r\n borderBottomWidth: hairline,\r\n };\r\n\r\n return StyleSheet.create({\r\n cell: {\r\n flex: 1,\r\n justifyContent: \"center\",\r\n paddingHorizontal: cellPadH,\r\n paddingVertical: cellPadV,\r\n },\r\n\r\n cellBordered: {\r\n paddingHorizontal: cellPadH,\r\n paddingVertical: cellPadV,\r\n },\r\n\r\n cellBorderedBorder: {\r\n borderRightColor: borderColor,\r\n borderRightStyle: \"solid\",\r\n borderRightWidth: hairline,\r\n },\r\n\r\n cellCompact: {\r\n paddingHorizontal: cellPadHCompact,\r\n paddingVertical: cellPadVCompact,\r\n },\r\n\r\n cellFixed: {\r\n flexGrow: 0,\r\n flexShrink: 0,\r\n justifyContent: \"center\",\r\n paddingHorizontal: cellPadH,\r\n paddingVertical: cellPadV,\r\n },\r\n\r\n cellGridBorder: {\r\n borderRightColor: borderColor,\r\n borderRightStyle: \"solid\",\r\n borderRightWidth: hairline,\r\n },\r\n\r\n cellMinimal: {\r\n paddingHorizontal: spacing[2] - 2,\r\n paddingVertical: spacing[1] + 1,\r\n },\r\n\r\n cellPrimaryHeader: {\r\n paddingHorizontal: cellPadH,\r\n paddingVertical: cellPadV,\r\n },\r\n\r\n cellStriped: {\r\n paddingHorizontal: cellPadH,\r\n paddingVertical: cellPadV,\r\n },\r\n\r\n cellText: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n lineHeight: 1.2,\r\n },\r\n cellTextCompact: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.xs,\r\n lineHeight: 1.2,\r\n },\r\n cellTextFooter: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n fontWeight: fontWeights.semibold,\r\n lineHeight: 1.2,\r\n },\r\n cellTextHeaderBordered: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n fontWeight: fontWeights.bold,\r\n lineHeight: 1.2,\r\n },\r\n cellTextHeaderCompact: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.xs,\r\n fontWeight: fontWeights.semibold,\r\n letterSpacing: 0.6,\r\n lineHeight: 1.2,\r\n textTransform: \"uppercase\",\r\n },\r\n cellTextHeaderGrid: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n fontWeight: fontWeights.semibold,\r\n lineHeight: 1.2,\r\n },\r\n cellTextHeaderLine: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n fontWeight: fontWeights.semibold,\r\n lineHeight: 1.2,\r\n },\r\n\r\n cellTextHeaderMinimal: {\r\n color: t.colors.mutedForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n fontWeight: fontWeights.medium,\r\n lineHeight: 1.2,\r\n },\r\n cellTextHeaderPrimaryHeader: {\r\n color: t.colors.primaryForeground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: typography.xs,\r\n fontWeight: fontWeights.semibold,\r\n letterSpacing: 0.6,\r\n lineHeight: 1.2,\r\n textTransform: \"uppercase\",\r\n },\r\n cellTextHeaderStriped: {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n fontSize: t.typography.body.fontSize,\r\n fontWeight: fontWeights.semibold,\r\n lineHeight: 1.2,\r\n },\r\n row: {\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n },\r\n rowBordered: rowDivider,\r\n rowCompact: rowDivider,\r\n rowFooter: {\r\n borderTopColor: borderColor,\r\n borderTopStyle: \"solid\",\r\n borderTopWidth: rule,\r\n },\r\n\r\n rowFooterStriped: {\r\n backgroundColor: t.colors.muted,\r\n borderTopColor: borderColor,\r\n borderTopStyle: \"solid\",\r\n borderTopWidth: rule,\r\n },\r\n rowGrid: rowDivider,\r\n\r\n rowHeaderBordered: {\r\n backgroundColor: t.colors.muted,\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: hairline,\r\n },\r\n\r\n rowHeaderCompact: {\r\n backgroundColor: t.colors.muted,\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: rule,\r\n },\r\n rowHeaderGrid: {\r\n backgroundColor: t.colors.muted,\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: rule,\r\n },\r\n\r\n rowHeaderLine: {\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: rule,\r\n },\r\n rowHeaderMinimal: {\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: rule,\r\n },\r\n rowHeaderPrimaryHeader: {\r\n backgroundColor: t.colors.primary,\r\n },\r\n rowHeaderStriped: {\r\n backgroundColor: t.colors.muted,\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: rule,\r\n },\r\n rowLine: rowDivider,\r\n\r\n rowMinimal: rowDivider,\r\n rowPrimaryHeader: rowDivider,\r\n\r\n rowStripe: {\r\n backgroundColor: t.colors.muted,\r\n },\r\n\r\n rowStriped: {},\r\n table: {\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n marginBottom: t.spacing.componentGap,\r\n width: \"100%\",\r\n },\r\n tableBordered: {\r\n borderBottomLeftRadius: borderRadius.sm,\r\n borderBottomRightRadius: borderRadius.sm,\r\n borderColor,\r\n borderStyle: \"solid\",\r\n borderTopLeftRadius: borderRadius.sm,\r\n borderTopRightRadius: borderRadius.sm,\r\n borderWidth: rule,\r\n overflow: \"hidden\" as const,\r\n },\r\n tableCompact: {\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: hairline,\r\n },\r\n tableGrid: {\r\n borderBottomLeftRadius: borderRadius.md,\r\n borderBottomRightRadius: borderRadius.md,\r\n borderColor,\r\n borderStyle: \"solid\",\r\n borderTopLeftRadius: borderRadius.md,\r\n borderTopRightRadius: borderRadius.md,\r\n borderWidth: thick,\r\n overflow: \"hidden\" as const,\r\n },\r\n tableLine: {\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: hairline,\r\n },\r\n tableMinimal: {\r\n paddingVertical: spacing[2],\r\n },\r\n\r\n tablePrimaryHeader: {\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: hairline,\r\n },\r\n\r\n tableStriped: {\r\n borderBottomColor: borderColor,\r\n borderBottomStyle: \"solid\",\r\n borderBottomWidth: hairline,\r\n borderTopColor: borderColor,\r\n borderTopStyle: \"solid\",\r\n borderTopWidth: hairline,\r\n },\r\n });\r\n};\r\n",
+ "content": "import { StyleSheet } from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\n/**\n * Creates all table styles derived from the active theme.\n * @param t - The resolved PdfcnTheme instance.\n */\nexport const createTableStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius, fontWeights, typography } = t.primitives;\n const borderColor = t.colors.border;\n\n const hairline = 0.5;\n const rule = 1;\n const thick = 1.5;\n\n const cellPadV = spacing[2] - 2;\n const cellPadH = spacing[2] + 2;\n // eslint-disable-next-line prefer-destructuring\n const cellPadVCompact = spacing[0.5];\n // eslint-disable-next-line prefer-destructuring\n const cellPadHCompact = spacing[2];\n\n const rowDivider = {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\" as const,\n borderBottomWidth: hairline,\n };\n\n return StyleSheet.create({\n cell: {\n flex: 1,\n justifyContent: \"center\",\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellBordered: {\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellBorderedBorder: {\n borderRightColor: borderColor,\n borderRightStyle: \"solid\",\n borderRightWidth: hairline,\n },\n\n cellCompact: {\n paddingHorizontal: cellPadHCompact,\n paddingVertical: cellPadVCompact,\n },\n\n cellFixed: {\n flexGrow: 0,\n flexShrink: 0,\n justifyContent: \"center\",\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellGridBorder: {\n borderRightColor: borderColor,\n borderRightStyle: \"solid\",\n borderRightWidth: hairline,\n },\n\n cellMinimal: {\n paddingHorizontal: spacing[2] - 2,\n paddingVertical: spacing[1] + 1,\n },\n\n cellPrimaryHeader: {\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellStriped: {\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellText: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n lineHeight: 1.2,\n },\n cellTextCompact: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n lineHeight: 1.2,\n },\n cellTextFooter: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n cellTextHeaderBordered: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.bold,\n lineHeight: 1.2,\n },\n cellTextHeaderCompact: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.6,\n lineHeight: 1.2,\n textTransform: \"uppercase\",\n },\n cellTextHeaderGrid: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n cellTextHeaderLine: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n\n cellTextHeaderMinimal: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.medium,\n lineHeight: 1.2,\n },\n cellTextHeaderPrimaryHeader: {\n color: t.colors.primaryForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.6,\n lineHeight: 1.2,\n textTransform: \"uppercase\",\n },\n cellTextHeaderStriped: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n row: {\n display: \"flex\",\n flexDirection: \"row\",\n },\n rowBordered: rowDivider,\n rowCompact: rowDivider,\n rowFooter: {\n borderTopColor: borderColor,\n borderTopStyle: \"solid\",\n borderTopWidth: rule,\n },\n\n rowFooterStriped: {\n backgroundColor: t.colors.muted,\n borderTopColor: borderColor,\n borderTopStyle: \"solid\",\n borderTopWidth: rule,\n },\n rowGrid: rowDivider,\n\n rowHeaderBordered: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n\n rowHeaderCompact: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowHeaderGrid: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n\n rowHeaderLine: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowHeaderMinimal: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowHeaderPrimaryHeader: {\n backgroundColor: t.colors.primary,\n },\n rowHeaderStriped: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowLine: rowDivider,\n\n rowMinimal: rowDivider,\n rowPrimaryHeader: rowDivider,\n\n rowStripe: {\n backgroundColor: t.colors.muted,\n },\n\n rowStriped: {},\n table: {\n display: \"flex\",\n flexDirection: \"column\",\n marginBottom: t.spacing.componentGap,\n width: \"100%\",\n },\n tableBordered: {\n borderBottomLeftRadius: borderRadius.sm,\n borderBottomRightRadius: borderRadius.sm,\n borderColor,\n borderStyle: \"solid\",\n borderTopLeftRadius: borderRadius.sm,\n borderTopRightRadius: borderRadius.sm,\n borderWidth: rule,\n overflow: \"hidden\" as const,\n },\n tableCompact: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n tableGrid: {\n borderBottomLeftRadius: borderRadius.md,\n borderBottomRightRadius: borderRadius.md,\n borderColor,\n borderStyle: \"solid\",\n borderTopLeftRadius: borderRadius.md,\n borderTopRightRadius: borderRadius.md,\n borderWidth: thick,\n overflow: \"hidden\" as const,\n },\n tableLine: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n tableMinimal: {\n paddingVertical: spacing[2],\n },\n\n tablePrimaryHeader: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n\n tableStriped: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n borderTopColor: borderColor,\n borderTopStyle: \"solid\",\n borderTopWidth: hairline,\n },\n });\n};\n",
"type": "registry:component",
"target": "components/pdf/table/table.styles.ts"
},
{
"path": "registry/bases/takumi/components/table/table.tsx",
- "content": "import { Children, cloneElement, isValidElement } from \"react\";\r\nimport type { ReactElement, ReactNode } from \"react\";\r\n\r\nimport {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n Text as PDFText,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\n\r\nimport { createTableStyles } from \"./table.styles\";\r\nimport type {\r\n TableCellProps,\r\n TableProps,\r\n TableRowProps,\r\n TableSectionProps,\r\n TableVariant,\r\n} from \"./table.types\";\r\n\r\nexport const TableHeader = ({ children, style }: TableSectionProps) => (\r\n <View style={style}>{children}</View>\r\n);\r\n\r\nexport const TableBody = ({ children, style }: TableSectionProps) => (\r\n <View style={style}>{children}</View>\r\n);\r\n\r\nexport const TableFooter = ({ children, style }: TableSectionProps) => (\r\n <View style={style}>{children}</View>\r\n);\r\n\r\nexport const TableCell = ({\r\n header,\r\n footer,\r\n align,\r\n width,\r\n children,\r\n style,\r\n variant = \"line\",\r\n _last,\r\n}: TableCellProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createTableStyles(theme), [theme]);\r\n const cellStyles: Style[] =\r\n width === undefined\r\n ? [styles.cell]\r\n : [styles.cellFixed, { width } as Style];\r\n\r\n const cellVariantStyle = (\r\n {\r\n bordered: styles.cellBordered,\r\n compact: styles.cellCompact,\r\n minimal: styles.cellMinimal,\r\n \"primary-header\": styles.cellPrimaryHeader,\r\n striped: styles.cellStriped,\r\n } as Partial<Record<TableVariant, Style>>\r\n )[variant];\r\n if (cellVariantStyle) {\r\n cellStyles.push(cellVariantStyle);\r\n }\r\n\r\n if (variant === \"grid\" && !_last) {\r\n cellStyles.push(styles.cellGridBorder);\r\n } else if (variant === \"bordered\" && !_last) {\r\n cellStyles.push(styles.cellBorderedBorder);\r\n }\r\n\r\n if (align) {\r\n cellStyles.push({ textAlign: align } as Style);\r\n }\r\n\r\n const styleArray = style ? [...cellStyles, style] : cellStyles;\r\n\r\n let textStyle: Style = styles.cellText;\r\n if (header) {\r\n textStyle = {\r\n bordered: styles.cellTextHeaderBordered,\r\n compact: styles.cellTextHeaderCompact,\r\n grid: styles.cellTextHeaderGrid,\r\n line: styles.cellTextHeaderLine,\r\n minimal: styles.cellTextHeaderMinimal,\r\n \"primary-header\": styles.cellTextHeaderPrimaryHeader,\r\n striped: styles.cellTextHeaderStriped,\r\n }[variant];\r\n } else if (footer) {\r\n textStyle = styles.cellTextFooter;\r\n } else if (variant === \"compact\") {\r\n textStyle = styles.cellTextCompact;\r\n }\r\n\r\n const content =\r\n typeof children === \"string\" ? (\r\n <PDFText\r\n style={[\r\n textStyle,\r\n align ? { textAlign: align } : {},\r\n { margin: 0, padding: 0 },\r\n ]}\r\n >\r\n {children}\r\n </PDFText>\r\n ) : (\r\n children\r\n );\r\n\r\n return <View style={styleArray}>{content}</View>;\r\n};\r\n\r\nexport const TableRow = ({\r\n header,\r\n footer,\r\n stripe,\r\n children,\r\n style,\r\n variant = \"line\",\r\n}: TableRowProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createTableStyles(theme), [theme]);\r\n const rowStyles: Style[] = [\r\n styles.row,\r\n {\r\n bordered: styles.rowBordered,\r\n compact: styles.rowCompact,\r\n grid: styles.rowGrid,\r\n line: styles.rowLine,\r\n minimal: styles.rowMinimal,\r\n \"primary-header\": styles.rowPrimaryHeader,\r\n striped: styles.rowStriped,\r\n }[variant],\r\n ];\r\n\r\n if (header) {\r\n rowStyles.push(\r\n {\r\n bordered: styles.rowHeaderBordered,\r\n compact: styles.rowHeaderCompact,\r\n grid: styles.rowHeaderGrid,\r\n line: styles.rowHeaderLine,\r\n minimal: styles.rowHeaderMinimal,\r\n \"primary-header\": styles.rowHeaderPrimaryHeader,\r\n striped: styles.rowHeaderStriped,\r\n }[variant]\r\n );\r\n }\r\n\r\n if (footer) {\r\n if (variant === \"striped\") {\r\n rowStyles.push(styles.rowFooterStriped);\r\n } else {\r\n rowStyles.push(styles.rowFooter);\r\n }\r\n }\r\n\r\n if (stripe && !header && !footer) {\r\n rowStyles.push(styles.rowStripe);\r\n }\r\n\r\n const styleArray = style ? [...rowStyles, style] : rowStyles;\r\n const childArray = Children.toArray(children);\r\n const processedChildren = childArray.map((child, i) => {\r\n if (isValidElement(child) && child.type === TableCell) {\r\n return cloneElement(child as ReactElement<TableCellProps>, {\r\n _last: i === childArray.length - 1,\r\n footer,\r\n header,\r\n variant,\r\n });\r\n }\r\n return child;\r\n });\r\n\r\n return (\r\n <View\r\n style={[{ breakInside: \"avoid\" as const }, styleArray]\r\n .flat()\r\n .filter(Boolean)}\r\n >\r\n {processedChildren}\r\n </View>\r\n );\r\n};\r\n\r\nconst processTableChildren = (\r\n children: ReactNode,\r\n variant: TableVariant,\r\n zebraStripe: boolean\r\n): ReactNode => {\r\n let bodyRowIndex = 0;\r\n\r\n return Children.map(children, (child) => {\r\n if (!isValidElement(child)) {\r\n return child;\r\n }\r\n\r\n if (\r\n child.type === TableHeader ||\r\n child.type === TableBody ||\r\n child.type === TableFooter\r\n ) {\r\n const isBody = child.type === TableBody;\r\n const sectionChild = child as ReactElement<TableSectionProps>;\r\n const sectionChildren = Children.map(\r\n sectionChild.props.children,\r\n (rowChild) => {\r\n if (isValidElement(rowChild) && rowChild.type === TableRow) {\r\n const rowProps: Partial<TableRowProps> = { variant };\r\n\r\n if (isBody && zebraStripe) {\r\n const isStripe = bodyRowIndex % 2 === 1;\r\n bodyRowIndex += 1;\r\n if (isStripe) {\r\n rowProps.stripe = true;\r\n }\r\n }\r\n\r\n return cloneElement(\r\n rowChild as ReactElement<TableRowProps>,\r\n rowProps\r\n );\r\n }\r\n return rowChild;\r\n }\r\n );\r\n\r\n return cloneElement(child, {}, sectionChildren);\r\n }\r\n\r\n if (child.type === TableRow) {\r\n return cloneElement(child as ReactElement<TableRowProps>, { variant });\r\n }\r\n\r\n return child;\r\n });\r\n};\r\n\r\nexport const Table = ({\r\n children,\r\n style,\r\n variant = \"line\",\r\n zebraStripe = false,\r\n noWrap = false,\r\n}: TableProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createTableStyles(theme), [theme]);\r\n const tableStyles: Style[] = [styles.table];\r\n const effectiveZebra = variant === \"striped\" ? true : zebraStripe;\r\n\r\n tableStyles.push(\r\n {\r\n bordered: styles.tableBordered,\r\n compact: styles.tableCompact,\r\n grid: styles.tableGrid,\r\n line: styles.tableLine,\r\n minimal: styles.tableMinimal,\r\n \"primary-header\": styles.tablePrimaryHeader,\r\n striped: styles.tableStriped,\r\n }[variant]\r\n );\r\n\r\n const styleArray = style ? [...tableStyles, style] : tableStyles;\r\n const processedChildren = processTableChildren(\r\n children,\r\n variant,\r\n effectiveZebra\r\n );\r\n\r\n const inner = <View style={styleArray}>{processedChildren}</View>;\r\n return noWrap ? (\r\n <View style={[{ breakInside: \"avoid\" as const }].filter(Boolean)}>\r\n {inner}\r\n </View>\r\n ) : (\r\n inner\r\n );\r\n};\r\n",
+ "content": "import { Children, cloneElement, isValidElement } from \"react\";\nimport type { ReactElement, ReactNode } from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n Text as PDFText,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\n\nimport { createTableStyles } from \"./table.styles\";\nimport type {\n TableCellProps,\n TableProps,\n TableRowProps,\n TableSectionProps,\n TableVariant,\n} from \"./table.types\";\n\nexport const TableHeader = ({ children, style }: TableSectionProps) => (\n <View style={style}>{children}</View>\n);\n\nexport const TableBody = ({ children, style }: TableSectionProps) => (\n <View style={style}>{children}</View>\n);\n\nexport const TableFooter = ({ children, style }: TableSectionProps) => (\n <View style={style}>{children}</View>\n);\n\nexport const TableCell = ({\n header,\n footer,\n align,\n width,\n children,\n style,\n variant = \"line\",\n _last,\n}: TableCellProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createTableStyles(theme), [theme]);\n const cellStyles: Style[] =\n width === undefined\n ? [styles.cell]\n : [styles.cellFixed, { width } as Style];\n\n const cellVariantStyle = (\n {\n bordered: styles.cellBordered,\n compact: styles.cellCompact,\n minimal: styles.cellMinimal,\n \"primary-header\": styles.cellPrimaryHeader,\n striped: styles.cellStriped,\n } as Partial<Record<TableVariant, Style>>\n )[variant];\n if (cellVariantStyle) {\n cellStyles.push(cellVariantStyle);\n }\n\n if (variant === \"grid\" && !_last) {\n cellStyles.push(styles.cellGridBorder);\n } else if (variant === \"bordered\" && !_last) {\n cellStyles.push(styles.cellBorderedBorder);\n }\n\n if (align) {\n cellStyles.push({ textAlign: align } as Style);\n }\n\n const styleArray = style ? [...cellStyles, style] : cellStyles;\n\n let textStyle: Style = styles.cellText;\n if (header) {\n textStyle = {\n bordered: styles.cellTextHeaderBordered,\n compact: styles.cellTextHeaderCompact,\n grid: styles.cellTextHeaderGrid,\n line: styles.cellTextHeaderLine,\n minimal: styles.cellTextHeaderMinimal,\n \"primary-header\": styles.cellTextHeaderPrimaryHeader,\n striped: styles.cellTextHeaderStriped,\n }[variant];\n } else if (footer) {\n textStyle = styles.cellTextFooter;\n } else if (variant === \"compact\") {\n textStyle = styles.cellTextCompact;\n }\n\n const content =\n typeof children === \"string\" ? (\n <PDFText\n style={[\n textStyle,\n align ? { textAlign: align } : {},\n { margin: 0, padding: 0 },\n ]}\n >\n {children}\n </PDFText>\n ) : (\n children\n );\n\n return <View style={styleArray}>{content}</View>;\n};\n\nexport const TableRow = ({\n header,\n footer,\n stripe,\n children,\n style,\n variant = \"line\",\n}: TableRowProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createTableStyles(theme), [theme]);\n const rowStyles: Style[] = [\n styles.row,\n {\n bordered: styles.rowBordered,\n compact: styles.rowCompact,\n grid: styles.rowGrid,\n line: styles.rowLine,\n minimal: styles.rowMinimal,\n \"primary-header\": styles.rowPrimaryHeader,\n striped: styles.rowStriped,\n }[variant],\n ];\n\n if (header) {\n rowStyles.push(\n {\n bordered: styles.rowHeaderBordered,\n compact: styles.rowHeaderCompact,\n grid: styles.rowHeaderGrid,\n line: styles.rowHeaderLine,\n minimal: styles.rowHeaderMinimal,\n \"primary-header\": styles.rowHeaderPrimaryHeader,\n striped: styles.rowHeaderStriped,\n }[variant]\n );\n }\n\n if (footer) {\n if (variant === \"striped\") {\n rowStyles.push(styles.rowFooterStriped);\n } else {\n rowStyles.push(styles.rowFooter);\n }\n }\n\n if (stripe && !header && !footer) {\n rowStyles.push(styles.rowStripe);\n }\n\n const styleArray = style ? [...rowStyles, style] : rowStyles;\n const childArray = Children.toArray(children);\n const processedChildren = childArray.map((child, i) => {\n if (isValidElement(child) && child.type === TableCell) {\n return cloneElement(child as ReactElement<TableCellProps>, {\n _last: i === childArray.length - 1,\n footer,\n header,\n variant,\n });\n }\n return child;\n });\n\n return (\n <View\n style={[{ breakInside: \"avoid\" as const }, styleArray]\n .flat()\n .filter(Boolean)}\n >\n {processedChildren}\n </View>\n );\n};\n\nconst processTableChildren = (\n children: ReactNode,\n variant: TableVariant,\n zebraStripe: boolean\n): ReactNode => {\n let bodyRowIndex = 0;\n\n return Children.map(children, (child) => {\n if (!isValidElement(child)) {\n return child;\n }\n\n if (\n child.type === TableHeader ||\n child.type === TableBody ||\n child.type === TableFooter\n ) {\n const isBody = child.type === TableBody;\n const sectionChild = child as ReactElement<TableSectionProps>;\n const sectionChildren = Children.map(\n sectionChild.props.children,\n (rowChild) => {\n if (isValidElement(rowChild) && rowChild.type === TableRow) {\n const rowProps: Partial<TableRowProps> = { variant };\n\n if (isBody && zebraStripe) {\n const isStripe = bodyRowIndex % 2 === 1;\n bodyRowIndex += 1;\n if (isStripe) {\n rowProps.stripe = true;\n }\n }\n\n return cloneElement(\n rowChild as ReactElement<TableRowProps>,\n rowProps\n );\n }\n return rowChild;\n }\n );\n\n return cloneElement(child, {}, sectionChildren);\n }\n\n if (child.type === TableRow) {\n return cloneElement(child as ReactElement<TableRowProps>, { variant });\n }\n\n return child;\n });\n};\n\nexport const Table = ({\n children,\n style,\n variant = \"line\",\n zebraStripe = false,\n noWrap = false,\n}: TableProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createTableStyles(theme), [theme]);\n const tableStyles: Style[] = [styles.table];\n const effectiveZebra = variant === \"striped\" ? true : zebraStripe;\n\n tableStyles.push(\n {\n bordered: styles.tableBordered,\n compact: styles.tableCompact,\n grid: styles.tableGrid,\n line: styles.tableLine,\n minimal: styles.tableMinimal,\n \"primary-header\": styles.tablePrimaryHeader,\n striped: styles.tableStriped,\n }[variant]\n );\n\n const styleArray = style ? [...tableStyles, style] : tableStyles;\n const processedChildren = processTableChildren(\n children,\n variant,\n effectiveZebra\n );\n\n const inner = <View style={styleArray}>{processedChildren}</View>;\n return noWrap ? (\n <View style={[{ breakInside: \"avoid\" as const }].filter(Boolean)}>\n {inner}\n </View>\n ) : (\n inner\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/table/table.tsx"
},
{
"path": "registry/bases/takumi/components/table/table.types.ts",
- "content": "import type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\n\r\n/** Table visual style variant. */\r\nexport type TableVariant =\r\n | \"line\"\r\n | \"grid\"\r\n | \"minimal\"\r\n | \"striped\"\r\n | \"compact\"\r\n | \"bordered\"\r\n | \"primary-header\";\r\n\r\n/**\r\n * Table container with visual style variants and optional zebra striping.\r\n * Props - `variant` | `zebraStripe` | `noWrap` | `children` | `style`\r\n * @see {@link TableProps}\r\n */\r\nexport interface TableProps extends PDFComponentProps {\r\n /**\r\n * @default 'line'\r\n */\r\n variant?: TableVariant;\r\n /**\r\n * @default false\r\n */\r\n zebraStripe?: boolean;\r\n /**\r\n * @default false\r\n */\r\n noWrap?: boolean;\r\n}\r\n\r\nexport type TableSectionProps = PDFComponentProps;\r\n\r\n/**\r\n * Table row with optional header, footer, and stripe states.\r\n * Props - `header` | `footer` | `stripe` | `variant` | `children` | `style`\r\n * @see {@link TableRowProps}\r\n */\r\nexport interface TableRowProps extends PDFComponentProps {\r\n header?: boolean;\r\n footer?: boolean;\r\n stripe?: boolean;\r\n variant?: TableVariant;\r\n}\r\n\r\n/**\r\n * Table cell with alignment, width, and header or footer text styling.\r\n * Props - `header` | `footer` | `align` | `width` | `variant` | `_last` | `children` | `style`\r\n * @see {@link TableCellProps}\r\n */\r\nexport interface TableCellProps extends PDFComponentProps {\r\n header?: boolean;\r\n footer?: boolean;\r\n align?: \"left\" | \"center\" | \"right\";\r\n width?: string | number;\r\n variant?: TableVariant;\r\n _last?: boolean;\r\n}\r\n",
+ "content": "import type { PDFComponentProps } from \"@/types/pdf-components\";\n\n/** Table visual style variant. */\nexport type TableVariant =\n | \"line\"\n | \"grid\"\n | \"minimal\"\n | \"striped\"\n | \"compact\"\n | \"bordered\"\n | \"primary-header\";\n\n/**\n * Table container with visual style variants and optional zebra striping.\n * Props - `variant` | `zebraStripe` | `noWrap` | `children` | `style`\n * @see {@link TableProps}\n */\nexport interface TableProps extends PDFComponentProps {\n /**\n * @default 'line'\n */\n variant?: TableVariant;\n /**\n * @default false\n */\n zebraStripe?: boolean;\n /**\n * @default false\n */\n noWrap?: boolean;\n}\n\nexport type TableSectionProps = PDFComponentProps;\n\n/**\n * Table row with optional header, footer, and stripe states.\n * Props - `header` | `footer` | `stripe` | `variant` | `children` | `style`\n * @see {@link TableRowProps}\n */\nexport interface TableRowProps extends PDFComponentProps {\n header?: boolean;\n footer?: boolean;\n stripe?: boolean;\n variant?: TableVariant;\n}\n\n/**\n * Table cell with alignment, width, and header or footer text styling.\n * Props - `header` | `footer` | `align` | `width` | `variant` | `_last` | `children` | `style`\n * @see {@link TableCellProps}\n */\nexport interface TableCellProps extends PDFComponentProps {\n header?: boolean;\n footer?: boolean;\n align?: \"left\" | \"center\" | \"right\";\n width?: string | number;\n variant?: TableVariant;\n _last?: boolean;\n}\n",
"type": "registry:component",
"target": "components/pdf/table/table.types.ts"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/text.json b/apps/web/public/r/takumi/text.json
index c9ed236..8b49212 100644
--- a/apps/web/public/r/takumi/text.json
+++ b/apps/web/public/r/takumi/text.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/takumi/components/text/text.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n Text as PDFText,\r\n StyleSheet,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type TextVariant = \"xs\" | \"sm\" | \"base\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\";\r\nexport type TextWeight = \"normal\" | \"medium\" | \"semibold\" | \"bold\";\r\nexport type TextDecoration = \"underline\" | \"line-through\" | \"none\";\r\n\r\n/**\r\n * Body text with typography scale, alignment, and decoration options.\r\n * Props - `variant` | `align` | `color` | `weight` | `italic` | `decoration` | `transform` | `noMargin` | `children` | `style`\r\n * @see {@link TextProps}\r\n */\r\nexport interface TextProps extends PDFComponentProps {\r\n /**\r\n * @default 'base'\r\n */\r\n variant?: TextVariant;\r\n /**\r\n * @default 'left'\r\n */\r\n align?: \"left\" | \"center\" | \"right\" | \"justify\";\r\n color?: string;\r\n /**\r\n * @default 'normal'\r\n */\r\n weight?: TextWeight;\r\n /**\r\n * @default false\r\n */\r\n italic?: boolean;\r\n /**\r\n * @default 'none'\r\n */\r\n decoration?: TextDecoration;\r\n transform?: \"uppercase\" | \"lowercase\" | \"capitalize\";\r\n /**\r\n * @default false\r\n */\r\n noMargin?: boolean;\r\n}\r\n\r\nconst createTextStyles = (t: PdfcnTheme) => {\r\n const { fontWeights, letterSpacing } = t.primitives;\r\n const base = {\r\n color: t.colors.foreground,\r\n fontFamily: t.typography.body.fontFamily,\r\n lineHeight: t.typography.body.lineHeight,\r\n marginBottom: t.spacing.paragraphGap,\r\n marginTop: 0,\r\n };\r\n return StyleSheet.create({\r\n \"2xl\": { ...base, fontSize: t.primitives.typography[\"2xl\"] },\r\n \"3xl\": { ...base, fontSize: t.primitives.typography[\"3xl\"] },\r\n base: { ...base, fontSize: t.primitives.typography.base },\r\n capitalize: { textTransform: \"capitalize\" },\r\n decorationNone: { textDecoration: \"none\" },\r\n italic: { fontStyle: \"italic\" },\r\n lg: { ...base, fontSize: t.primitives.typography.lg },\r\n lineThrough: { textDecoration: \"line-through\" },\r\n lowercase: { textTransform: \"lowercase\" },\r\n noMargin: { marginBottom: 0, marginTop: 0 },\r\n sm: { ...base, fontSize: t.primitives.typography.sm },\r\n text: { ...base, fontSize: t.typography.body.fontSize },\r\n underline: { textDecoration: \"underline\" },\r\n uppercase: {\r\n letterSpacing: letterSpacing.wider * 10,\r\n textTransform: \"uppercase\",\r\n },\r\n weightBold: { fontWeight: fontWeights.bold },\r\n weightMedium: { fontWeight: fontWeights.medium },\r\n weightNormal: { fontWeight: fontWeights.regular },\r\n weightSemibold: { fontWeight: fontWeights.semibold },\r\n xl: { ...base, fontSize: t.primitives.typography.xl },\r\n xs: { ...base, fontSize: t.primitives.typography.xs },\r\n });\r\n};\r\n\r\nexport const Text = ({\r\n variant,\r\n align,\r\n color,\r\n weight,\r\n italic,\r\n decoration,\r\n transform,\r\n noMargin,\r\n children,\r\n style,\r\n}: TextProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createTextStyles(theme), [theme]);\r\n const weightMap = {\r\n bold: styles.weightBold,\r\n medium: styles.weightMedium,\r\n normal: styles.weightNormal,\r\n semibold: styles.weightSemibold,\r\n };\r\n const decorationMap = {\r\n \"line-through\": styles.lineThrough,\r\n none: styles.decorationNone,\r\n underline: styles.underline,\r\n };\r\n const transformMap = {\r\n capitalize: styles.capitalize,\r\n lowercase: styles.lowercase,\r\n uppercase: styles.uppercase,\r\n };\r\n const styleArray: Style[] = [variant ? styles[variant] : styles.text];\r\n if (weight && weight in weightMap) {\r\n styleArray.push(weightMap[weight]);\r\n }\r\n if (italic) {\r\n styleArray.push(styles.italic);\r\n }\r\n if (decoration && decoration in decorationMap) {\r\n styleArray.push(decorationMap[decoration]);\r\n }\r\n if (transform && transform in transformMap) {\r\n styleArray.push(transformMap[transform]);\r\n }\r\n if (noMargin) {\r\n styleArray.push(styles.noMargin);\r\n }\r\n const semantic = {} as Style;\r\n if (align) {\r\n semantic.textAlign = align;\r\n }\r\n if (color) {\r\n semantic.color = resolveColor(color, theme.colors);\r\n }\r\n if (Object.keys(semantic).length > 0) {\r\n styleArray.push(semantic);\r\n }\r\n if (style) {\r\n styleArray.push(...[style].flat());\r\n }\r\n return <PDFText style={styleArray}>{children}</PDFText>;\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type TextVariant = \"xs\" | \"sm\" | \"base\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\";\nexport type TextWeight = \"normal\" | \"medium\" | \"semibold\" | \"bold\";\nexport type TextDecoration = \"underline\" | \"line-through\" | \"none\";\n\n/**\n * Body text with typography scale, alignment, and decoration options.\n * Props - `variant` | `align` | `color` | `weight` | `italic` | `decoration` | `transform` | `noMargin` | `children` | `style`\n * @see {@link TextProps}\n */\nexport interface TextProps extends PDFComponentProps {\n /**\n * @default 'base'\n */\n variant?: TextVariant;\n /**\n * @default 'left'\n */\n align?: \"left\" | \"center\" | \"right\" | \"justify\";\n color?: string;\n /**\n * @default 'normal'\n */\n weight?: TextWeight;\n /**\n * @default false\n */\n italic?: boolean;\n /**\n * @default 'none'\n */\n decoration?: TextDecoration;\n transform?: \"uppercase\" | \"lowercase\" | \"capitalize\";\n /**\n * @default false\n */\n noMargin?: boolean;\n}\n\nconst createTextStyles = (t: PdfcnTheme) => {\n const { fontWeights, letterSpacing } = t.primitives;\n const base = {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n lineHeight: t.typography.body.lineHeight,\n marginBottom: t.spacing.paragraphGap,\n marginTop: 0,\n };\n return StyleSheet.create({\n \"2xl\": { ...base, fontSize: t.primitives.typography[\"2xl\"] },\n \"3xl\": { ...base, fontSize: t.primitives.typography[\"3xl\"] },\n base: { ...base, fontSize: t.primitives.typography.base },\n capitalize: { textTransform: \"capitalize\" },\n decorationNone: { textDecoration: \"none\" },\n italic: { fontStyle: \"italic\" },\n lg: { ...base, fontSize: t.primitives.typography.lg },\n lineThrough: { textDecoration: \"line-through\" },\n lowercase: { textTransform: \"lowercase\" },\n noMargin: { marginBottom: 0, marginTop: 0 },\n sm: { ...base, fontSize: t.primitives.typography.sm },\n text: { ...base, fontSize: t.typography.body.fontSize },\n underline: { textDecoration: \"underline\" },\n uppercase: {\n letterSpacing: letterSpacing.wider * 10,\n textTransform: \"uppercase\",\n },\n weightBold: { fontWeight: fontWeights.bold },\n weightMedium: { fontWeight: fontWeights.medium },\n weightNormal: { fontWeight: fontWeights.regular },\n weightSemibold: { fontWeight: fontWeights.semibold },\n xl: { ...base, fontSize: t.primitives.typography.xl },\n xs: { ...base, fontSize: t.primitives.typography.xs },\n });\n};\n\nexport const Text = ({\n variant,\n align,\n color,\n weight,\n italic,\n decoration,\n transform,\n noMargin,\n children,\n style,\n}: TextProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createTextStyles(theme), [theme]);\n const weightMap = {\n bold: styles.weightBold,\n medium: styles.weightMedium,\n normal: styles.weightNormal,\n semibold: styles.weightSemibold,\n };\n const decorationMap = {\n \"line-through\": styles.lineThrough,\n none: styles.decorationNone,\n underline: styles.underline,\n };\n const transformMap = {\n capitalize: styles.capitalize,\n lowercase: styles.lowercase,\n uppercase: styles.uppercase,\n };\n const styleArray: Style[] = [variant ? styles[variant] : styles.text];\n if (weight && weight in weightMap) {\n styleArray.push(weightMap[weight]);\n }\n if (italic) {\n styleArray.push(styles.italic);\n }\n if (decoration && decoration in decorationMap) {\n styleArray.push(decorationMap[decoration]);\n }\n if (transform && transform in transformMap) {\n styleArray.push(transformMap[transform]);\n }\n if (noMargin) {\n styleArray.push(styles.noMargin);\n }\n const semantic = {} as Style;\n if (align) {\n semantic.textAlign = align;\n }\n if (color) {\n semantic.color = resolveColor(color, theme.colors);\n }\n if (Object.keys(semantic).length > 0) {\n styleArray.push(semantic);\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return <PDFText style={styleArray}>{children}</PDFText>;\n};\n",
"type": "registry:component",
"target": "components/pdf/text/text.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/theme-provider.json b/apps/web/public/r/takumi/theme-provider.json
index 5557ed8..33a20ca 100644
--- a/apps/web/public/r/takumi/theme-provider.json
+++ b/apps/web/public/r/takumi/theme-provider.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/takumi/components/theme-provider.tsx",
- "content": "import { isValidElement } from \"react\";\nimport type { DependencyList, ReactNode } from \"react\";\n\nimport { professionalTheme } from \"@/registry/themes/professional\";\n\nexport type PdfcnTheme = typeof professionalTheme;\n\nlet serializedTheme = professionalTheme;\n\nexport interface PdfcnThemeProviderProps {\n theme?: PdfcnTheme;\n children: ReactNode;\n}\n\nconst renderForSerializer = (\n children: ReactNode,\n theme: PdfcnTheme\n): ReactNode => {\n serializedTheme = theme;\n\n if (!isValidElement(children) || typeof children.type !== \"function\") {\n return children;\n }\n\n return (children.type as (props: unknown) => ReactNode)(children.props);\n};\n\nexport const PdfcnThemeProvider = ({\n theme,\n children,\n}: PdfcnThemeProviderProps) =>\n renderForSerializer(children, theme ?? professionalTheme);\n\nexport const usePdfcnTheme = (): PdfcnTheme => serializedTheme;\n\nexport const useSafeMemo = <T,>(factory: () => T, _deps: DependencyList): T =>\n factory();\n",
+ "content": "import { isValidElement } from \"react\";\nimport type { DependencyList, ReactNode } from \"react\";\n\nimport { professionalTheme } from \"@/lib/pdf-themes/professional\";\n\nexport type PdfcnTheme = typeof professionalTheme;\n\nlet serializedTheme = professionalTheme;\n\nexport interface PdfcnThemeProviderProps {\n theme?: PdfcnTheme;\n children: ReactNode;\n}\n\nconst renderForSerializer = (\n children: ReactNode,\n theme: PdfcnTheme\n): ReactNode => {\n serializedTheme = theme;\n\n if (!isValidElement(children) || typeof children.type !== \"function\") {\n return children;\n }\n\n return (children.type as (props: unknown) => ReactNode)(children.props);\n};\n\nexport const PdfcnThemeProvider = ({\n theme,\n children,\n}: PdfcnThemeProviderProps) =>\n renderForSerializer(children, theme ?? professionalTheme);\n\nexport const usePdfcnTheme = (): PdfcnTheme => serializedTheme;\n\nexport const useSafeMemo = <T,>(factory: () => T, _deps: DependencyList): T =>\n factory();\n",
"type": "registry:lib",
"target": "components/pdf/theme-provider.tsx"
}
],
"type": "registry:lib"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/utils.json b/apps/web/public/r/takumi/utils.json
index 31f9f86..80672b7 100644
--- a/apps/web/public/r/takumi/utils.json
+++ b/apps/web/public/r/takumi/utils.json
@@ -13,28 +13,28 @@
"files": [
{
"path": "registry/bases/takumi/lib/resolve-color.ts",
- "content": "import type { ColorTokens } from \"@/registry/types/pdf-themes\";\r\n\r\n/** Theme color token keys that can be used for the color prop */\r\nexport const THEME_COLOR_KEYS = [\r\n \"foreground\",\r\n \"background\",\r\n \"muted\",\r\n \"mutedForeground\",\r\n \"primary\",\r\n \"primaryForeground\",\r\n \"border\",\r\n \"accent\",\r\n \"destructive\",\r\n \"success\",\r\n \"warning\",\r\n \"info\",\r\n] as const satisfies (keyof ColorTokens)[];\r\n\r\n/** Resolves a color value: theme token key → hex, or raw CSS color as-is. */\r\nexport const resolveColor = (value: string, colors: ColorTokens): string => {\r\n const key = value as (typeof THEME_COLOR_KEYS)[number];\r\n return THEME_COLOR_KEYS.includes(key) ? colors[key] : value;\r\n};\r\n",
+ "content": "import type { ColorTokens } from \"@/types/pdf-themes\";\n\n/** Theme color token keys that can be used for the color prop */\nexport const THEME_COLOR_KEYS = [\n \"foreground\",\n \"background\",\n \"muted\",\n \"mutedForeground\",\n \"primary\",\n \"primaryForeground\",\n \"border\",\n \"accent\",\n \"destructive\",\n \"success\",\n \"warning\",\n \"info\",\n] as const satisfies (keyof ColorTokens)[];\n\n/** Resolves a color value: theme token key → hex, or raw CSS color as-is. */\nexport const resolveColor = (value: string, colors: ColorTokens): string => {\n const key = value as (typeof THEME_COLOR_KEYS)[number];\n return THEME_COLOR_KEYS.includes(key) ? colors[key] : value;\n};\n",
"type": "registry:lib",
"target": "lib/resolve-color.ts"
},
{
"path": "registry/bases/takumi/components/theme-provider.tsx",
- "content": "import { isValidElement } from \"react\";\r\nimport type { DependencyList, ReactNode } from \"react\";\r\n\r\nimport { professionalTheme } from \"@/registry/themes/professional\";\r\n\r\nexport type PdfcnTheme = typeof professionalTheme;\r\n\r\nlet serializedTheme = professionalTheme;\r\n\r\nexport interface PdfcnThemeProviderProps {\r\n theme?: PdfcnTheme;\r\n children: ReactNode;\r\n}\r\n\r\nconst renderForSerializer = (\r\n children: ReactNode,\r\n theme: PdfcnTheme\r\n): ReactNode => {\r\n serializedTheme = theme;\r\n\r\n if (!isValidElement(children) || typeof children.type !== \"function\") {\r\n return children;\r\n }\r\n\r\n return (children.type as (props: unknown) => ReactNode)(children.props);\r\n};\r\n\r\nexport const PdfcnThemeProvider = ({\r\n theme,\r\n children,\r\n}: PdfcnThemeProviderProps) =>\r\n renderForSerializer(children, theme ?? professionalTheme);\r\n\r\nexport const usePdfcnTheme = (): PdfcnTheme => serializedTheme;\r\n\r\nexport const useSafeMemo = <T,>(factory: () => T, _deps: DependencyList): T =>\r\n factory();\r\n",
+ "content": "import { isValidElement } from \"react\";\nimport type { DependencyList, ReactNode } from \"react\";\n\nimport { professionalTheme } from \"@/lib/pdf-themes/professional\";\n\nexport type PdfcnTheme = typeof professionalTheme;\n\nlet serializedTheme = professionalTheme;\n\nexport interface PdfcnThemeProviderProps {\n theme?: PdfcnTheme;\n children: ReactNode;\n}\n\nconst renderForSerializer = (\n children: ReactNode,\n theme: PdfcnTheme\n): ReactNode => {\n serializedTheme = theme;\n\n if (!isValidElement(children) || typeof children.type !== \"function\") {\n return children;\n }\n\n return (children.type as (props: unknown) => ReactNode)(children.props);\n};\n\nexport const PdfcnThemeProvider = ({\n theme,\n children,\n}: PdfcnThemeProviderProps) =>\n renderForSerializer(children, theme ?? professionalTheme);\n\nexport const usePdfcnTheme = (): PdfcnTheme => serializedTheme;\n\nexport const useSafeMemo = <T,>(factory: () => T, _deps: DependencyList): T =>\n factory();\n",
"type": "registry:lib",
"target": "components/pdf/theme-provider.tsx"
},
{
"path": "registry/bases/takumi/lib/pdf-primitives.tsx",
- "content": "import type { ReactNode, ImgHTMLAttributes, AnchorHTMLAttributes } from \"react\";\r\n\r\nexport type Style = Record<string, unknown>;\r\n\r\nexport const StyleSheet = {\r\n create<T extends Record<string, Style>>(styles: T): T {\r\n return styles;\r\n },\r\n};\r\n\r\ntype StyleInput = Style | Style[] | false | null | undefined;\r\n\r\n/**\r\n * pdfcn's shared component tokens follow the PDF convention of using points.\r\n * Takumi follows browser CSS instead, where numeric lengths are pixels at\r\n * 96 DPI. Converting at the primitive boundary keeps the public component API\r\n * and the generated document's physical measurements aligned with Forme.\r\n */\r\nexport const PDF_POINT_TO_CSS_PIXEL = 96 / 72;\r\n\r\nexport const pointToCssPixel = (value: number): number =>\r\n value * PDF_POINT_TO_CSS_PIXEL;\r\n\r\nconst POINT_LENGTH_PROPERTIES = new Set([\r\n \"blockSize\",\r\n \"borderBlockEndWidth\",\r\n \"borderBlockStartWidth\",\r\n \"borderBlockWidth\",\r\n \"borderBottomLeftRadius\",\r\n \"borderBottomRightRadius\",\r\n \"borderBottomWidth\",\r\n \"borderEndEndRadius\",\r\n \"borderEndStartRadius\",\r\n \"borderInlineEndWidth\",\r\n \"borderInlineStartWidth\",\r\n \"borderInlineWidth\",\r\n \"borderLeftWidth\",\r\n \"borderRadius\",\r\n \"borderRightWidth\",\r\n \"borderStartEndRadius\",\r\n \"borderStartStartRadius\",\r\n \"borderTopLeftRadius\",\r\n \"borderTopRightRadius\",\r\n \"borderTopWidth\",\r\n \"borderWidth\",\r\n \"bottom\",\r\n \"columnGap\",\r\n \"flexBasis\",\r\n \"fontSize\",\r\n \"gap\",\r\n \"height\",\r\n \"inlineSize\",\r\n \"inset\",\r\n \"insetBlock\",\r\n \"insetBlockEnd\",\r\n \"insetBlockStart\",\r\n \"insetInline\",\r\n \"insetInlineEnd\",\r\n \"insetInlineStart\",\r\n \"left\",\r\n \"letterSpacing\",\r\n \"margin\",\r\n \"marginBlock\",\r\n \"marginBlockEnd\",\r\n \"marginBlockStart\",\r\n \"marginBottom\",\r\n \"marginInline\",\r\n \"marginInlineEnd\",\r\n \"marginInlineStart\",\r\n \"marginLeft\",\r\n \"marginRight\",\r\n \"marginTop\",\r\n \"maxBlockSize\",\r\n \"maxHeight\",\r\n \"maxInlineSize\",\r\n \"maxWidth\",\r\n \"minBlockSize\",\r\n \"minHeight\",\r\n \"minInlineSize\",\r\n \"minWidth\",\r\n \"outlineOffset\",\r\n \"outlineWidth\",\r\n \"padding\",\r\n \"paddingBlock\",\r\n \"paddingBlockEnd\",\r\n \"paddingBlockStart\",\r\n \"paddingBottom\",\r\n \"paddingInline\",\r\n \"paddingInlineEnd\",\r\n \"paddingInlineStart\",\r\n \"paddingLeft\",\r\n \"paddingRight\",\r\n \"paddingTop\",\r\n \"right\",\r\n \"rowGap\",\r\n \"textDecorationThickness\",\r\n \"textIndent\",\r\n \"top\",\r\n \"width\",\r\n]);\r\n\r\ninterface ViewProps {\r\n children?: ReactNode;\r\n style?: StyleInput;\r\n className?: string;\r\n wrap?: boolean;\r\n fixed?: boolean;\r\n break?: boolean;\r\n minPresenceAhead?: number;\r\n}\r\n\r\nexport const normalizeTakumiStyle = (style: Style): Style => {\r\n const {\r\n marginHorizontal,\r\n marginVertical,\r\n paddingHorizontal,\r\n paddingVertical,\r\n ...normalized\r\n } = style;\r\n\r\n if (marginHorizontal !== undefined) {\r\n normalized.marginLeft ??= marginHorizontal;\r\n normalized.marginRight ??= marginHorizontal;\r\n }\r\n if (marginVertical !== undefined) {\r\n normalized.marginBottom ??= marginVertical;\r\n normalized.marginTop ??= marginVertical;\r\n }\r\n if (paddingHorizontal !== undefined) {\r\n normalized.paddingLeft ??= paddingHorizontal;\r\n normalized.paddingRight ??= paddingHorizontal;\r\n }\r\n if (paddingVertical !== undefined) {\r\n normalized.paddingBottom ??= paddingVertical;\r\n normalized.paddingTop ??= paddingVertical;\r\n }\r\n\r\n const borderSides = [\"Top\", \"Right\", \"Bottom\", \"Left\"] as const;\r\n if (normalized.borderWidth !== undefined) {\r\n normalized.borderStyle ??= \"solid\";\r\n }\r\n for (const side of borderSides) {\r\n if (normalized[`border${side}Width`] !== undefined) {\r\n normalized[`border${side}Style`] ??= \"solid\";\r\n }\r\n }\r\n\r\n return Object.fromEntries(\r\n Object.entries(normalized).map(([property, value]) => [\r\n property,\r\n typeof value === \"number\" && POINT_LENGTH_PROPERTIES.has(property)\r\n ? pointToCssPixel(value)\r\n : value,\r\n ])\r\n );\r\n};\r\n\r\nexport const flatten = (\r\n style?: StyleInput\r\n): Record<string, unknown> | undefined => {\r\n if (!style) {\r\n return undefined;\r\n }\r\n if (Array.isArray(style)) {\r\n return normalizeTakumiStyle(Object.assign({}, ...style.filter(Boolean)));\r\n }\r\n return normalizeTakumiStyle(style);\r\n};\r\n\r\nexport const View = ({ children, style, className, ...rest }: ViewProps) => {\r\n const {\r\n wrap,\r\n fixed,\r\n break: br,\r\n minPresenceAhead: _m,\r\n ...dom\r\n } = rest as ViewProps & Record<string, unknown>;\r\n const merged = {\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n ...flatten(style),\r\n };\r\n if (br) {\r\n Object.assign(merged, { breakBefore: \"page\" });\r\n }\r\n if (wrap === false) {\r\n Object.assign(merged, { breakInside: \"avoid\" });\r\n }\r\n if (fixed) {\r\n Object.assign(merged, { position: \"fixed\" });\r\n }\r\n return (\r\n <div\r\n className={className}\r\n style={merged as React.CSSProperties}\r\n {...(dom as object)}\r\n >\r\n {children}\r\n </div>\r\n );\r\n};\r\n\r\ninterface TextProps {\r\n children?: ReactNode;\r\n style?: StyleInput;\r\n className?: string;\r\n render?: (info: { pageNumber: number; totalPages: number }) => ReactNode;\r\n fixed?: boolean;\r\n href?: string;\r\n src?: string;\r\n}\r\n\r\nexport const Text = ({\r\n children,\r\n style,\r\n className,\r\n render: _render,\r\n href,\r\n src,\r\n ...rest\r\n}: TextProps) => {\r\n const merged = flatten(style) as React.CSSProperties | undefined;\r\n const link = href ?? src;\r\n if (link) {\r\n return (\r\n <a href={link} className={className} style={merged} {...(rest as object)}>\r\n {children}\r\n </a>\r\n );\r\n }\r\n return (\r\n <span className={className} style={merged} {...(rest as object)}>\r\n {children}\r\n </span>\r\n );\r\n};\r\n\r\nexport const Image = ({\r\n src,\r\n style,\r\n ...rest\r\n}: {\r\n src: string | { uri: string };\r\n style?: StyleInput;\r\n} & Omit<ImgHTMLAttributes<HTMLImageElement>, \"src\" | \"style\">) => {\r\n const resolved = typeof src === \"string\" ? src : src.uri;\r\n return (\r\n // eslint-disable-next-line eslint(nextjs/no-img-element) -- PDF primitive, not Next.js page\r\n <img\r\n src={resolved}\r\n style={flatten(style) as React.CSSProperties}\r\n alt=\"\"\r\n {...rest}\r\n />\r\n );\r\n};\r\n\r\nexport const Link = ({\r\n src,\r\n children,\r\n style,\r\n ...rest\r\n}: {\r\n src: string;\r\n children?: ReactNode;\r\n style?: StyleInput;\r\n} & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, \"href\" | \"style\">) => (\r\n <a href={src} style={flatten(style) as React.CSSProperties} {...rest}>\r\n {children}\r\n </a>\r\n);\r\n\r\nexport const Document = ({\r\n children,\r\n title,\r\n style,\r\n}: {\r\n children?: ReactNode;\r\n title?: string;\r\n style?: StyleInput;\r\n}) => (\r\n <div\r\n data-pdf-document={title}\r\n style={\r\n {\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n ...flatten(style),\r\n } as React.CSSProperties\r\n }\r\n >\r\n {children}\r\n </div>\r\n);\r\n\r\nexport const Page = ({\r\n children,\r\n size: _size,\r\n style,\r\n}: {\r\n children?: ReactNode;\r\n size?: string | { width: number; height: number };\r\n style?: StyleInput;\r\n}) => (\r\n <div\r\n data-pdf-page\r\n style={\r\n {\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n ...flatten(style),\r\n } as React.CSSProperties\r\n }\r\n >\r\n {children}\r\n </div>\r\n);\r\n",
+ "content": "import type { ReactNode, ImgHTMLAttributes, AnchorHTMLAttributes } from \"react\";\n\nexport type Style = Record<string, unknown>;\n\nexport const StyleSheet = {\n create<T extends Record<string, Style>>(styles: T): T {\n return styles;\n },\n};\n\ntype StyleInput = Style | Style[] | false | null | undefined;\n\n/**\n * pdfcn's shared component tokens follow the PDF convention of using points.\n * Takumi follows browser CSS instead, where numeric lengths are pixels at\n * 96 DPI. Converting at the primitive boundary keeps the public component API\n * and the generated document's physical measurements aligned with Forme.\n */\nexport const PDF_POINT_TO_CSS_PIXEL = 96 / 72;\n\nexport const pointToCssPixel = (value: number): number =>\n value * PDF_POINT_TO_CSS_PIXEL;\n\nconst POINT_LENGTH_PROPERTIES = new Set([\n \"blockSize\",\n \"borderBlockEndWidth\",\n \"borderBlockStartWidth\",\n \"borderBlockWidth\",\n \"borderBottomLeftRadius\",\n \"borderBottomRightRadius\",\n \"borderBottomWidth\",\n \"borderEndEndRadius\",\n \"borderEndStartRadius\",\n \"borderInlineEndWidth\",\n \"borderInlineStartWidth\",\n \"borderInlineWidth\",\n \"borderLeftWidth\",\n \"borderRadius\",\n \"borderRightWidth\",\n \"borderStartEndRadius\",\n \"borderStartStartRadius\",\n \"borderTopLeftRadius\",\n \"borderTopRightRadius\",\n \"borderTopWidth\",\n \"borderWidth\",\n \"bottom\",\n \"columnGap\",\n \"flexBasis\",\n \"fontSize\",\n \"gap\",\n \"height\",\n \"inlineSize\",\n \"inset\",\n \"insetBlock\",\n \"insetBlockEnd\",\n \"insetBlockStart\",\n \"insetInline\",\n \"insetInlineEnd\",\n \"insetInlineStart\",\n \"left\",\n \"letterSpacing\",\n \"margin\",\n \"marginBlock\",\n \"marginBlockEnd\",\n \"marginBlockStart\",\n \"marginBottom\",\n \"marginInline\",\n \"marginInlineEnd\",\n \"marginInlineStart\",\n \"marginLeft\",\n \"marginRight\",\n \"marginTop\",\n \"maxBlockSize\",\n \"maxHeight\",\n \"maxInlineSize\",\n \"maxWidth\",\n \"minBlockSize\",\n \"minHeight\",\n \"minInlineSize\",\n \"minWidth\",\n \"outlineOffset\",\n \"outlineWidth\",\n \"padding\",\n \"paddingBlock\",\n \"paddingBlockEnd\",\n \"paddingBlockStart\",\n \"paddingBottom\",\n \"paddingInline\",\n \"paddingInlineEnd\",\n \"paddingInlineStart\",\n \"paddingLeft\",\n \"paddingRight\",\n \"paddingTop\",\n \"right\",\n \"rowGap\",\n \"textDecorationThickness\",\n \"textIndent\",\n \"top\",\n \"width\",\n]);\n\ninterface ViewProps {\n children?: ReactNode;\n style?: StyleInput;\n className?: string;\n wrap?: boolean;\n fixed?: boolean;\n break?: boolean;\n minPresenceAhead?: number;\n}\n\nexport const normalizeTakumiStyle = (style: Style): Style => {\n const {\n marginHorizontal,\n marginVertical,\n paddingHorizontal,\n paddingVertical,\n ...normalized\n } = style;\n\n if (marginHorizontal !== undefined) {\n normalized.marginLeft ??= marginHorizontal;\n normalized.marginRight ??= marginHorizontal;\n }\n if (marginVertical !== undefined) {\n normalized.marginBottom ??= marginVertical;\n normalized.marginTop ??= marginVertical;\n }\n if (paddingHorizontal !== undefined) {\n normalized.paddingLeft ??= paddingHorizontal;\n normalized.paddingRight ??= paddingHorizontal;\n }\n if (paddingVertical !== undefined) {\n normalized.paddingBottom ??= paddingVertical;\n normalized.paddingTop ??= paddingVertical;\n }\n\n const borderSides = [\"Top\", \"Right\", \"Bottom\", \"Left\"] as const;\n if (normalized.borderWidth !== undefined) {\n normalized.borderStyle ??= \"solid\";\n }\n for (const side of borderSides) {\n if (normalized[`border${side}Width`] !== undefined) {\n normalized[`border${side}Style`] ??= \"solid\";\n }\n }\n\n return Object.fromEntries(\n Object.entries(normalized).map(([property, value]) => [\n property,\n typeof value === \"number\" && POINT_LENGTH_PROPERTIES.has(property)\n ? pointToCssPixel(value)\n : value,\n ])\n );\n};\n\nexport const flatten = (\n style?: StyleInput\n): Record<string, unknown> | undefined => {\n if (!style) {\n return undefined;\n }\n if (Array.isArray(style)) {\n return normalizeTakumiStyle(Object.assign({}, ...style.filter(Boolean)));\n }\n return normalizeTakumiStyle(style);\n};\n\nexport const View = ({ children, style, className, ...rest }: ViewProps) => {\n const {\n wrap,\n fixed,\n break: br,\n minPresenceAhead: _m,\n ...dom\n } = rest as ViewProps & Record<string, unknown>;\n const merged = {\n display: \"flex\",\n flexDirection: \"column\",\n ...flatten(style),\n };\n if (br) {\n Object.assign(merged, { breakBefore: \"page\" });\n }\n if (wrap === false) {\n Object.assign(merged, { breakInside: \"avoid\" });\n }\n if (fixed) {\n Object.assign(merged, { position: \"fixed\" });\n }\n return (\n <div\n className={className}\n style={merged as React.CSSProperties}\n {...(dom as object)}\n >\n {children}\n </div>\n );\n};\n\ninterface TextProps {\n children?: ReactNode;\n style?: StyleInput;\n className?: string;\n render?: (info: { pageNumber: number; totalPages: number }) => ReactNode;\n fixed?: boolean;\n href?: string;\n src?: string;\n}\n\nexport const Text = ({\n children,\n style,\n className,\n render: _render,\n href,\n src,\n ...rest\n}: TextProps) => {\n const merged = flatten(style) as React.CSSProperties | undefined;\n const link = href ?? src;\n if (link) {\n return (\n <a href={link} className={className} style={merged} {...(rest as object)}>\n {children}\n </a>\n );\n }\n return (\n <span className={className} style={merged} {...(rest as object)}>\n {children}\n </span>\n );\n};\n\nexport const Image = ({\n src,\n style,\n ...rest\n}: {\n src: string | { uri: string };\n style?: StyleInput;\n} & Omit<ImgHTMLAttributes<HTMLImageElement>, \"src\" | \"style\">) => {\n const resolved = typeof src === \"string\" ? src : src.uri;\n return (\n // eslint-disable-next-line eslint(nextjs/no-img-element) -- PDF primitive, not Next.js page\n <img\n src={resolved}\n style={flatten(style) as React.CSSProperties}\n alt=\"\"\n {...rest}\n />\n );\n};\n\nexport const Link = ({\n src,\n children,\n style,\n ...rest\n}: {\n src: string;\n children?: ReactNode;\n style?: StyleInput;\n} & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, \"href\" | \"style\">) => (\n <a href={src} style={flatten(style) as React.CSSProperties} {...rest}>\n {children}\n </a>\n);\n\nexport const Document = ({\n children,\n title,\n style,\n}: {\n children?: ReactNode;\n title?: string;\n style?: StyleInput;\n}) => (\n <div\n data-pdf-document={title}\n style={\n {\n display: \"flex\",\n flexDirection: \"column\",\n ...flatten(style),\n } as React.CSSProperties\n }\n >\n {children}\n </div>\n);\n\nexport const Page = ({\n children,\n size: _size,\n style,\n}: {\n children?: ReactNode;\n size?: string | { width: number; height: number };\n style?: StyleInput;\n}) => (\n <div\n data-pdf-page\n style={\n {\n display: \"flex\",\n flexDirection: \"column\",\n ...flatten(style),\n } as React.CSSProperties\n }\n >\n {children}\n </div>\n);\n",
"type": "registry:lib",
"target": "lib/pdf-primitives.tsx"
},
{
"path": "registry/bases/takumi/lib/pdf-svg.tsx",
- "content": "import type { CSSProperties, ReactNode, SVGProps } from \"react\";\r\n\r\nimport {\r\n normalizeTakumiStyle,\r\n pointToCssPixel,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\n\r\nexport const Svg = ({\r\n children,\r\n style,\r\n height,\r\n viewBox,\r\n width,\r\n ...rest\r\n}: SVGProps<SVGSVGElement> & { style?: CSSProperties }) => {\r\n const numericHeight = typeof height === \"number\" ? height : undefined;\r\n const numericWidth = typeof width === \"number\" ? width : undefined;\r\n\r\n return (\r\n <svg\r\n style={\r\n style\r\n ? (normalizeTakumiStyle(\r\n style as Record<string, unknown>\r\n ) as CSSProperties)\r\n : undefined\r\n }\r\n height={\r\n numericHeight === undefined ? height : pointToCssPixel(numericHeight)\r\n }\r\n viewBox={\r\n viewBox ??\r\n (numericWidth !== undefined && numericHeight !== undefined\r\n ? `0 0 ${numericWidth} ${numericHeight}`\r\n : undefined)\r\n }\r\n width={numericWidth === undefined ? width : pointToCssPixel(numericWidth)}\r\n {...rest}\r\n >\r\n {children}\r\n </svg>\r\n );\r\n};\r\n\r\nexport const Rect = (props: SVGProps<SVGRectElement>) => <rect {...props} />;\r\nexport const Circle = (props: SVGProps<SVGCircleElement>) => (\r\n <circle {...props} />\r\n);\r\nexport const G = (props: SVGProps<SVGGElement>) => <g {...props} />;\r\nexport const Line = (props: SVGProps<SVGLineElement>) => <line {...props} />;\r\nexport const Path = (props: SVGProps<SVGPathElement>) => <path {...props} />;\r\nexport const SvgText = ({\r\n children,\r\n style,\r\n ...rest\r\n}: SVGProps<SVGTextElement> & {\r\n children?: ReactNode;\r\n style?: CSSProperties;\r\n}) => {\r\n const { fontFamily, fontSize, fontStyle, fontWeight, ...remainingStyle } =\r\n style ?? {};\r\n\r\n return (\r\n <text\r\n fontFamily={fontFamily ?? \"sans-serif\"}\r\n fontSize={fontSize}\r\n fontStyle={fontStyle}\r\n fontWeight={fontWeight}\r\n style={remainingStyle}\r\n {...rest}\r\n >\r\n {children}\r\n </text>\r\n );\r\n};\r\n",
+ "content": "import type { CSSProperties, ReactNode, SVGProps } from \"react\";\n\nimport {\n normalizeTakumiStyle,\n pointToCssPixel,\n} from \"@/lib/pdf-primitives\";\n\nexport const Svg = ({\n children,\n style,\n height,\n viewBox,\n width,\n ...rest\n}: SVGProps<SVGSVGElement> & { style?: CSSProperties }) => {\n const numericHeight = typeof height === \"number\" ? height : undefined;\n const numericWidth = typeof width === \"number\" ? width : undefined;\n\n return (\n <svg\n style={\n style\n ? (normalizeTakumiStyle(\n style as Record<string, unknown>\n ) as CSSProperties)\n : undefined\n }\n height={\n numericHeight === undefined ? height : pointToCssPixel(numericHeight)\n }\n viewBox={\n viewBox ??\n (numericWidth !== undefined && numericHeight !== undefined\n ? `0 0 ${numericWidth} ${numericHeight}`\n : undefined)\n }\n width={numericWidth === undefined ? width : pointToCssPixel(numericWidth)}\n {...rest}\n >\n {children}\n </svg>\n );\n};\n\nexport const Rect = (props: SVGProps<SVGRectElement>) => <rect {...props} />;\nexport const Circle = (props: SVGProps<SVGCircleElement>) => (\n <circle {...props} />\n);\nexport const G = (props: SVGProps<SVGGElement>) => <g {...props} />;\nexport const Line = (props: SVGProps<SVGLineElement>) => <line {...props} />;\nexport const Path = (props: SVGProps<SVGPathElement>) => <path {...props} />;\nexport const SvgText = ({\n children,\n style,\n ...rest\n}: SVGProps<SVGTextElement> & {\n children?: ReactNode;\n style?: CSSProperties;\n}) => {\n const { fontFamily, fontSize, fontStyle, fontWeight, ...remainingStyle } =\n style ?? {};\n\n return (\n <text\n fontFamily={fontFamily ?? \"sans-serif\"}\n fontSize={fontSize}\n fontStyle={fontStyle}\n fontWeight={fontWeight}\n style={remainingStyle}\n {...rest}\n >\n {children}\n </text>\n );\n};\n",
"type": "registry:lib",
"target": "lib/pdf-svg.tsx"
}
],
"type": "registry:lib"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/watermark.json b/apps/web/public/r/takumi/watermark.json
index 540ec0c..b672e58 100644
--- a/apps/web/public/r/takumi/watermark.json
+++ b/apps/web/public/r/takumi/watermark.json
@@ -13,10 +13,10 @@
"files": [
{
"path": "registry/bases/takumi/components/watermark/watermark.tsx",
- "content": "import {\r\n usePdfcnTheme,\r\n useSafeMemo,\r\n} from \"@/registry/bases/takumi/components/theme-provider\";\r\nimport {\r\n View,\r\n Text as PDFText,\r\n StyleSheet,\r\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\r\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\r\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\r\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\r\n\r\nexport type WatermarkPosition =\r\n | \"center\"\r\n | \"top-left\"\r\n | \"top-right\"\r\n | \"bottom-left\"\r\n | \"bottom-right\";\r\n\r\n/**\r\n * Diagonal watermark overlaid across the full page, repeated on every page.\r\n * Props - `text` | `opacity` | `fontSize` | `color` | `angle` | `position` | `style`\r\n * @see {@link PdfWatermarkProps}\r\n */\r\nexport interface PdfWatermarkProps extends Omit<PDFComponentProps, \"children\"> {\r\n text: string;\r\n opacity?: number;\r\n fontSize?: number;\r\n color?: string;\r\n angle?: number;\r\n position?: WatermarkPosition;\r\n children?: never;\r\n}\r\n\r\nconst createWatermarkStyles = (t: PdfcnTheme) => {\r\n const { fontWeights } = t.primitives;\r\n // Use page margins as corner insets so watermark position adapts to the active theme.\r\n const { marginTop, marginBottom, marginLeft, marginRight } = t.spacing.page;\r\n return StyleSheet.create({\r\n container: {\r\n alignItems: \"center\",\r\n bottom: 0,\r\n justifyContent: \"center\",\r\n left: 0,\r\n pointerEvents: \"none\",\r\n position: \"fixed\",\r\n right: 0,\r\n top: 0,\r\n zIndex: -1,\r\n },\r\n positionBottomLeft: {\r\n alignItems: \"flex-start\",\r\n justifyContent: \"flex-end\",\r\n paddingBottom: marginBottom,\r\n paddingLeft: marginLeft,\r\n },\r\n positionBottomRight: {\r\n alignItems: \"flex-end\",\r\n justifyContent: \"flex-end\",\r\n paddingBottom: marginBottom,\r\n paddingRight: marginRight,\r\n },\r\n positionCenter: { alignItems: \"center\", justifyContent: \"center\" },\r\n positionTopLeft: {\r\n alignItems: \"flex-start\",\r\n justifyContent: \"flex-start\",\r\n paddingLeft: marginLeft,\r\n paddingTop: marginTop,\r\n },\r\n positionTopRight: {\r\n alignItems: \"flex-end\",\r\n justifyContent: \"flex-start\",\r\n paddingRight: marginRight,\r\n paddingTop: marginTop,\r\n },\r\n text: {\r\n fontFamily: t.typography.heading.fontFamily,\r\n fontWeight: fontWeights.bold,\r\n letterSpacing: 4,\r\n textTransform: \"uppercase\",\r\n },\r\n });\r\n};\r\n\r\nexport const PdfWatermark = ({\r\n text,\r\n opacity = 0.15,\r\n fontSize = 60,\r\n color = \"mutedForeground\",\r\n angle = -45,\r\n position = \"center\",\r\n style,\r\n}: PdfWatermarkProps) => {\r\n const theme = usePdfcnTheme();\r\n const styles = useSafeMemo(() => createWatermarkStyles(theme), [theme]);\r\n const positionMap: Record<WatermarkPosition, Style> = {\r\n \"bottom-left\": styles.positionBottomLeft,\r\n \"bottom-right\": styles.positionBottomRight,\r\n center: styles.positionCenter,\r\n \"top-left\": styles.positionTopLeft,\r\n \"top-right\": styles.positionTopRight,\r\n };\r\n const containerStyles: Style[] = [styles.container, positionMap[position]];\r\n if (style) {\r\n containerStyles.push(...[style].flat());\r\n }\r\n const textStyles: Style[] = [\r\n styles.text,\r\n {\r\n color: resolveColor(color, theme.colors),\r\n fontSize,\r\n opacity,\r\n transform: `rotate(${angle}deg)`,\r\n },\r\n ];\r\n return (\r\n <View style={containerStyles}>\r\n <PDFText style={textStyles}>{text}</PDFText>\r\n </View>\r\n );\r\n};\r\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/lib/pdf-primitives\";\nimport type { Style } from \"@/lib/pdf-primitives\";\nimport { resolveColor } from \"@/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nexport type WatermarkPosition =\n | \"center\"\n | \"top-left\"\n | \"top-right\"\n | \"bottom-left\"\n | \"bottom-right\";\n\n/**\n * Diagonal watermark overlaid across the full page, repeated on every page.\n * Props - `text` | `opacity` | `fontSize` | `color` | `angle` | `position` | `style`\n * @see {@link PdfWatermarkProps}\n */\nexport interface PdfWatermarkProps extends Omit<PDFComponentProps, \"children\"> {\n text: string;\n opacity?: number;\n fontSize?: number;\n color?: string;\n angle?: number;\n position?: WatermarkPosition;\n children?: never;\n}\n\nconst createWatermarkStyles = (t: PdfcnTheme) => {\n const { fontWeights } = t.primitives;\n // Use page margins as corner insets so watermark position adapts to the active theme.\n const { marginTop, marginBottom, marginLeft, marginRight } = t.spacing.page;\n return StyleSheet.create({\n container: {\n alignItems: \"center\",\n bottom: 0,\n justifyContent: \"center\",\n left: 0,\n pointerEvents: \"none\",\n position: \"fixed\",\n right: 0,\n top: 0,\n zIndex: -1,\n },\n positionBottomLeft: {\n alignItems: \"flex-start\",\n justifyContent: \"flex-end\",\n paddingBottom: marginBottom,\n paddingLeft: marginLeft,\n },\n positionBottomRight: {\n alignItems: \"flex-end\",\n justifyContent: \"flex-end\",\n paddingBottom: marginBottom,\n paddingRight: marginRight,\n },\n positionCenter: { alignItems: \"center\", justifyContent: \"center\" },\n positionTopLeft: {\n alignItems: \"flex-start\",\n justifyContent: \"flex-start\",\n paddingLeft: marginLeft,\n paddingTop: marginTop,\n },\n positionTopRight: {\n alignItems: \"flex-end\",\n justifyContent: \"flex-start\",\n paddingRight: marginRight,\n paddingTop: marginTop,\n },\n text: {\n fontFamily: t.typography.heading.fontFamily,\n fontWeight: fontWeights.bold,\n letterSpacing: 4,\n textTransform: \"uppercase\",\n },\n });\n};\n\nexport const PdfWatermark = ({\n text,\n opacity = 0.15,\n fontSize = 60,\n color = \"mutedForeground\",\n angle = -45,\n position = \"center\",\n style,\n}: PdfWatermarkProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createWatermarkStyles(theme), [theme]);\n const positionMap: Record<WatermarkPosition, Style> = {\n \"bottom-left\": styles.positionBottomLeft,\n \"bottom-right\": styles.positionBottomRight,\n center: styles.positionCenter,\n \"top-left\": styles.positionTopLeft,\n \"top-right\": styles.positionTopRight,\n };\n const containerStyles: Style[] = [styles.container, positionMap[position]];\n if (style) {\n containerStyles.push(...[style].flat());\n }\n const textStyles: Style[] = [\n styles.text,\n {\n color: resolveColor(color, theme.colors),\n fontSize,\n opacity,\n transform: `rotate(${angle}deg)`,\n },\n ];\n return (\n <View style={containerStyles}>\n <PDFText style={textStyles}>{text}</PDFText>\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/watermark/watermark.tsx"
}
],
"type": "registry:ui"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/takumi/work-order.json b/apps/web/public/r/takumi/work-order.json
index 6d58992..3479d18 100644
--- a/apps/web/public/r/takumi/work-order.json
+++ b/apps/web/public/r/takumi/work-order.json
@@ -22,7 +22,7 @@
"files": [
{
"path": "registry/bases/takumi/blocks/work-order/work-order.tsx",
- "content": "import { Badge } from \"@/registry/bases/takumi/components/badge/badge\";\nimport type { BadgeVariant } from \"@/registry/bases/takumi/components/badge/badge\";\nimport { KeyValue } from \"@/registry/bases/takumi/components/key-value/key-value\";\nimport { PageFooter } from \"@/registry/bases/takumi/components/page-footer/page-footer\";\nimport { PageHeader } from \"@/registry/bases/takumi/components/page-header/page-header\";\nimport { PdfImage } from \"@/registry/bases/takumi/components/pdf-image/pdf-image\";\nimport { Section } from \"@/registry/bases/takumi/components/section/section\";\nimport { PdfSignatureBlock } from \"@/registry/bases/takumi/components/signature/signature\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/registry/bases/takumi/components/table/table\";\nimport { Text } from \"@/registry/bases/takumi/components/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type { WorkOrderData, WorkOrderPriority } from \"./work-order.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: WorkOrderData = {\n accentColor: \"#ea580c\",\n companyName: \"FixIt Pro Services\",\n customer: {\n accountNumber: \"ACC-10234\",\n address: \"789 Elm St, Austin, TX 78701\",\n name: \"Riverside Apartments\",\n phone: \"(512) 555-0199\",\n },\n customerNotes: \"Please service before end of month lease inspection.\",\n date: \"September 10, 2026\",\n equipment: {\n description: \"Commercial Dishwasher\",\n location: \"Kitchen — Unit 4B\",\n makeModel: \"Bosch SHP878ZD5N\",\n serialNumber: \"BSH-2024-88712\",\n },\n jobType: \"Repair\",\n labor: [\n {\n description: \"Diagnosis and repair\",\n hours: 2.5,\n rate: 95,\n technician: \"Mike Torres\",\n },\n ],\n parts: [\n {\n description: \"Drain Pump Assembly\",\n partNumber: \"PUMP-001\",\n qty: 1,\n unitPrice: 89.99,\n },\n {\n description: \"Drain Hose Kit\",\n partNumber: \"HOSE-012\",\n qty: 1,\n unitPrice: 24.5,\n },\n ],\n priority: \"High\",\n taxRate: 0.0825,\n technician: \"Mike Torres\",\n technicianNotes:\n \"Found clogged drain pump. Replaced pump and hose. Unit tested OK.\",\n warrantyInfo: \"90-day warranty on parts and labor.\",\n workOrderNumber: \"WO-2026-0452\",\n};\n\nconst PRIORITY_BADGE_VARIANT: Record<WorkOrderPriority, BadgeVariant> = {\n High: \"warning\",\n Low: \"default\",\n Medium: \"info\",\n Urgent: \"destructive\",\n};\n\nconst WorkOrderContent = ({ data }: { data: WorkOrderData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n checkbox: {\n borderColor: theme.colors.foreground,\n borderStyle: \"solid\",\n borderWidth: 1,\n height: 10,\n width: 10,\n },\n checkboxRow: {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 6,\n marginTop: theme.spacing.componentGap,\n },\n col: {\n flex: 1,\n paddingRight: 15,\n },\n label: {\n fontSize: 9,\n fontWeight: \"bold\",\n marginBottom: 2,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n row: {\n flexDirection: \"row\",\n },\n section: {\n marginBottom: theme.spacing.componentGap,\n },\n sectionSpaced: {\n marginBottom: theme.spacing.componentGap,\n marginTop: theme.spacing.componentGap,\n },\n signature: {\n marginBottom: 0,\n marginTop: 0,\n },\n });\n\n const partsTotal = data.parts.reduce(\n (sum, part) => sum + part.qty * part.unitPrice,\n 0\n );\n const laborTotal = data.labor.reduce(\n (sum, item) => sum + item.hours * item.rate,\n 0\n );\n const taxRate = data.taxRate ?? 0;\n const tax = (partsTotal + laborTotal) * taxRate;\n const grandTotal = partsTotal + laborTotal + tax;\n\n return (\n <Document title={`Work Order ${data.workOrderNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"logo-left\"\n logo={\n data.companyLogo ? (\n <PdfImage src={data.companyLogo} style={{ margin: 0 }} />\n ) : undefined\n }\n title={data.companyName}\n subtitle=\"Work Order\"\n rightText={`WO #${data.workOrderNumber}`}\n rightSubText={`Date: ${data.date}`}\n style={styles.section}\n />\n\n <Section\n noWrap\n spacing=\"none\"\n style={{\n ...styles.row,\n ...styles.section,\n alignItems: \"center\",\n justifyContent: \"space-between\",\n }}\n >\n <View style={{ alignItems: \"center\", flexDirection: \"row\", gap: 8 }}>\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\" }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Priority\n </Text>\n <Badge\n label={data.priority}\n variant={PRIORITY_BADGE_VARIANT[data.priority]}\n size=\"sm\"\n />\n </View>\n <Badge label={data.jobType} variant=\"outline\" size=\"sm\" />\n </Section>\n\n <Section\n noWrap\n spacing=\"none\"\n style={{ ...styles.row, ...styles.section }}\n >\n <View style={styles.col}>\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Customer\n </Text>\n <Text noMargin variant=\"xs\">\n {data.customer.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.customer.address}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.customer.phone}\n </Text>\n {data.customer.email ? (\n <Text noMargin variant=\"xs\">\n {data.customer.email}\n </Text>\n ) : null}\n {data.customer.accountNumber ? (\n <Text noMargin variant=\"xs\">\n {`Acct #: ${data.customer.accountNumber}`}\n </Text>\n ) : null}\n </View>\n <View style={styles.col}>\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Job Info\n </Text>\n <Text noMargin variant=\"xs\">\n {`Technician: ${data.technician}`}\n </Text>\n <Text noMargin variant=\"xs\">\n {`Job Type: ${data.jobType}`}\n </Text>\n </View>\n <View style={styles.col}>\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Equipment\n </Text>\n <Text noMargin variant=\"xs\">\n {data.equipment.description}\n </Text>\n {data.equipment.makeModel ? (\n <Text noMargin variant=\"xs\">\n {data.equipment.makeModel}\n </Text>\n ) : null}\n {data.equipment.serialNumber ? (\n <Text noMargin variant=\"xs\">\n {`S/N: ${data.equipment.serialNumber}`}\n </Text>\n ) : null}\n {data.equipment.location ? (\n <Text noMargin variant=\"xs\">\n {`Location: ${data.equipment.location}`}\n </Text>\n ) : null}\n </View>\n </Section>\n\n <Section spacing=\"none\">\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Parts Used\n </Text>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Part #</TableCell>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Unit Price</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.parts.map((part, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: parts have no stable id\n <TableRow key={index}>\n <TableCell>{part.partNumber}</TableCell>\n <TableCell>{part.description}</TableCell>\n <TableCell align=\"center\">{`${part.qty}`}</TableCell>\n <TableCell align=\"right\">{`$${part.unitPrice.toFixed(2)}`}</TableCell>\n <TableCell align=\"right\">{`$${(part.qty * part.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </Section>\n\n <Section spacing=\"none\">\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Labor\n </Text>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell>Technician</TableCell>\n <TableCell align=\"center\">Hours</TableCell>\n <TableCell align=\"right\">Rate</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.labor.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: labor entries have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell>{item.technician}</TableCell>\n <TableCell align=\"center\">{`${item.hours}`}</TableCell>\n <TableCell align=\"right\">{`$${item.rate.toFixed(2)}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.hours * item.rate).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </Section>\n\n <Section\n noWrap\n spacing=\"none\"\n style={{ ...styles.row, ...styles.section }}\n >\n <View style={{ flex: 1, paddingRight: 15 }}>\n {data.technicianNotes ? (\n <View>\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Technician Notes\n </Text>\n <Text noMargin variant=\"xs\">\n {data.technicianNotes}\n </Text>\n </View>\n ) : null}\n </View>\n <View style={{ marginLeft: \"auto\", width: 200 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n { key: \"Parts Total\", value: `$${partsTotal.toFixed(2)}` },\n { key: \"Labor Total\", value: `$${laborTotal.toFixed(2)}` },\n {\n key: `Tax (${(taxRate * 100).toFixed(2)}%)`,\n value: `$${tax.toFixed(2)}`,\n },\n {\n key: \"Grand Total\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${grandTotal.toFixed(2)}`,\n valueStyle: { fontSize: 12, fontWeight: \"bold\" },\n },\n ]}\n divided\n />\n </View>\n </Section>\n\n {data.customerNotes ? (\n <Section spacing=\"none\" style={styles.sectionSpaced}>\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Customer Notes\n </Text>\n <Text noMargin variant=\"xs\">\n {data.customerNotes}\n </Text>\n </Section>\n ) : null}\n\n <Section spacing=\"none\">\n <PdfSignatureBlock\n variant=\"double\"\n signers={[\n { date: data.date, label: \"Customer Signature\" },\n {\n date: data.date,\n label: \"Technician Signature\",\n name: data.technician,\n },\n ]}\n style={styles.signature}\n />\n <View style={styles.checkboxRow}>\n <View style={styles.checkbox} />\n <Text noMargin variant=\"xs\">\n Customer approves work performed and charges above\n </Text>\n </View>\n </Section>\n\n <PageFooter\n leftText={data.warrantyInfo}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const WorkOrderDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: WorkOrderData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <WorkOrderContent data={data} />\n </PdfcnThemeProvider>\n);\n",
+ "content": "import { Badge } from \"@/components/pdf/badge/badge\";\nimport type { BadgeVariant } from \"@/components/pdf/badge/badge\";\nimport { KeyValue } from \"@/components/pdf/key-value/key-value\";\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { PdfImage } from \"@/components/pdf/pdf-image/pdf-image\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport { PdfSignatureBlock } from \"@/components/pdf/signature/signature\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n PdfcnThemeProvider,\n usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { WorkOrderData, WorkOrderPriority } from \"./work-order.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: WorkOrderData = {\n accentColor: \"#ea580c\",\n companyName: \"FixIt Pro Services\",\n customer: {\n accountNumber: \"ACC-10234\",\n address: \"789 Elm St, Austin, TX 78701\",\n name: \"Riverside Apartments\",\n phone: \"(512) 555-0199\",\n },\n customerNotes: \"Please service before end of month lease inspection.\",\n date: \"September 10, 2026\",\n equipment: {\n description: \"Commercial Dishwasher\",\n location: \"Kitchen — Unit 4B\",\n makeModel: \"Bosch SHP878ZD5N\",\n serialNumber: \"BSH-2024-88712\",\n },\n jobType: \"Repair\",\n labor: [\n {\n description: \"Diagnosis and repair\",\n hours: 2.5,\n rate: 95,\n technician: \"Mike Torres\",\n },\n ],\n parts: [\n {\n description: \"Drain Pump Assembly\",\n partNumber: \"PUMP-001\",\n qty: 1,\n unitPrice: 89.99,\n },\n {\n description: \"Drain Hose Kit\",\n partNumber: \"HOSE-012\",\n qty: 1,\n unitPrice: 24.5,\n },\n ],\n priority: \"High\",\n taxRate: 0.0825,\n technician: \"Mike Torres\",\n technicianNotes:\n \"Found clogged drain pump. Replaced pump and hose. Unit tested OK.\",\n warrantyInfo: \"90-day warranty on parts and labor.\",\n workOrderNumber: \"WO-2026-0452\",\n};\n\nconst PRIORITY_BADGE_VARIANT: Record<WorkOrderPriority, BadgeVariant> = {\n High: \"warning\",\n Low: \"default\",\n Medium: \"info\",\n Urgent: \"destructive\",\n};\n\nconst WorkOrderContent = ({ data }: { data: WorkOrderData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n checkbox: {\n borderColor: theme.colors.foreground,\n borderStyle: \"solid\",\n borderWidth: 1,\n height: 10,\n width: 10,\n },\n checkboxRow: {\n alignItems: \"center\",\n flexDirection: \"row\",\n gap: 6,\n marginTop: theme.spacing.componentGap,\n },\n col: {\n flex: 1,\n paddingRight: 15,\n },\n label: {\n fontSize: 9,\n fontWeight: \"bold\",\n marginBottom: 2,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n row: {\n flexDirection: \"row\",\n },\n section: {\n marginBottom: theme.spacing.componentGap,\n },\n sectionSpaced: {\n marginBottom: theme.spacing.componentGap,\n marginTop: theme.spacing.componentGap,\n },\n signature: {\n marginBottom: 0,\n marginTop: 0,\n },\n });\n\n const partsTotal = data.parts.reduce(\n (sum, part) => sum + part.qty * part.unitPrice,\n 0\n );\n const laborTotal = data.labor.reduce(\n (sum, item) => sum + item.hours * item.rate,\n 0\n );\n const taxRate = data.taxRate ?? 0;\n const tax = (partsTotal + laborTotal) * taxRate;\n const grandTotal = partsTotal + laborTotal + tax;\n\n return (\n <Document title={`Work Order ${data.workOrderNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"logo-left\"\n logo={\n data.companyLogo ? (\n <PdfImage src={data.companyLogo} style={{ margin: 0 }} />\n ) : undefined\n }\n title={data.companyName}\n subtitle=\"Work Order\"\n rightText={`WO #${data.workOrderNumber}`}\n rightSubText={`Date: ${data.date}`}\n style={styles.section}\n />\n\n <Section\n noWrap\n spacing=\"none\"\n style={{\n ...styles.row,\n ...styles.section,\n alignItems: \"center\",\n justifyContent: \"space-between\",\n }}\n >\n <View style={{ alignItems: \"center\", flexDirection: \"row\", gap: 8 }}>\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\" }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Priority\n </Text>\n <Badge\n label={data.priority}\n variant={PRIORITY_BADGE_VARIANT[data.priority]}\n size=\"sm\"\n />\n </View>\n <Badge label={data.jobType} variant=\"outline\" size=\"sm\" />\n </Section>\n\n <Section\n noWrap\n spacing=\"none\"\n style={{ ...styles.row, ...styles.section }}\n >\n <View style={styles.col}>\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Customer\n </Text>\n <Text noMargin variant=\"xs\">\n {data.customer.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.customer.address}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.customer.phone}\n </Text>\n {data.customer.email ? (\n <Text noMargin variant=\"xs\">\n {data.customer.email}\n </Text>\n ) : null}\n {data.customer.accountNumber ? (\n <Text noMargin variant=\"xs\">\n {`Acct #: ${data.customer.accountNumber}`}\n </Text>\n ) : null}\n </View>\n <View style={styles.col}>\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Job Info\n </Text>\n <Text noMargin variant=\"xs\">\n {`Technician: ${data.technician}`}\n </Text>\n <Text noMargin variant=\"xs\">\n {`Job Type: ${data.jobType}`}\n </Text>\n </View>\n <View style={styles.col}>\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Equipment\n </Text>\n <Text noMargin variant=\"xs\">\n {data.equipment.description}\n </Text>\n {data.equipment.makeModel ? (\n <Text noMargin variant=\"xs\">\n {data.equipment.makeModel}\n </Text>\n ) : null}\n {data.equipment.serialNumber ? (\n <Text noMargin variant=\"xs\">\n {`S/N: ${data.equipment.serialNumber}`}\n </Text>\n ) : null}\n {data.equipment.location ? (\n <Text noMargin variant=\"xs\">\n {`Location: ${data.equipment.location}`}\n </Text>\n ) : null}\n </View>\n </Section>\n\n <Section spacing=\"none\">\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Parts Used\n </Text>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Part #</TableCell>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Unit Price</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.parts.map((part, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: parts have no stable id\n <TableRow key={index}>\n <TableCell>{part.partNumber}</TableCell>\n <TableCell>{part.description}</TableCell>\n <TableCell align=\"center\">{`${part.qty}`}</TableCell>\n <TableCell align=\"right\">{`$${part.unitPrice.toFixed(2)}`}</TableCell>\n <TableCell align=\"right\">{`$${(part.qty * part.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </Section>\n\n <Section spacing=\"none\">\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Labor\n </Text>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell>Technician</TableCell>\n <TableCell align=\"center\">Hours</TableCell>\n <TableCell align=\"right\">Rate</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.labor.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: labor entries have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell>{item.technician}</TableCell>\n <TableCell align=\"center\">{`${item.hours}`}</TableCell>\n <TableCell align=\"right\">{`$${item.rate.toFixed(2)}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.hours * item.rate).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </Section>\n\n <Section\n noWrap\n spacing=\"none\"\n style={{ ...styles.row, ...styles.section }}\n >\n <View style={{ flex: 1, paddingRight: 15 }}>\n {data.technicianNotes ? (\n <View>\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Technician Notes\n </Text>\n <Text noMargin variant=\"xs\">\n {data.technicianNotes}\n </Text>\n </View>\n ) : null}\n </View>\n <View style={{ marginLeft: \"auto\", width: 200 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n { key: \"Parts Total\", value: `$${partsTotal.toFixed(2)}` },\n { key: \"Labor Total\", value: `$${laborTotal.toFixed(2)}` },\n {\n key: `Tax (${(taxRate * 100).toFixed(2)}%)`,\n value: `$${tax.toFixed(2)}`,\n },\n {\n key: \"Grand Total\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${grandTotal.toFixed(2)}`,\n valueStyle: { fontSize: 12, fontWeight: \"bold\" },\n },\n ]}\n divided\n />\n </View>\n </Section>\n\n {data.customerNotes ? (\n <Section spacing=\"none\" style={styles.sectionSpaced}>\n <Text\n style={styles.label}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Customer Notes\n </Text>\n <Text noMargin variant=\"xs\">\n {data.customerNotes}\n </Text>\n </Section>\n ) : null}\n\n <Section spacing=\"none\">\n <PdfSignatureBlock\n variant=\"double\"\n signers={[\n { date: data.date, label: \"Customer Signature\" },\n {\n date: data.date,\n label: \"Technician Signature\",\n name: data.technician,\n },\n ]}\n style={styles.signature}\n />\n <View style={styles.checkboxRow}>\n <View style={styles.checkbox} />\n <Text noMargin variant=\"xs\">\n Customer approves work performed and charges above\n </Text>\n </View>\n </Section>\n\n <PageFooter\n leftText={data.warrantyInfo}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const WorkOrderDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: WorkOrderData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <WorkOrderContent data={data} />\n </PdfcnThemeProvider>\n);\n",
"type": "registry:block",
"target": "components/pdf/blocks/work-order/work-order.tsx"
},
@@ -34,4 +34,4 @@
}
],
"type": "registry:block"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/theme-blueprint.json b/apps/web/public/r/theme-blueprint.json
index f75cf2e..57f2d1c 100644
--- a/apps/web/public/r/theme-blueprint.json
+++ b/apps/web/public/r/theme-blueprint.json
@@ -6,13 +6,13 @@
"files": [
{
"path": "registry/themes/blueprint.ts",
- "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Blueprint theme preset.\n *\n * Character: Dark slate palette with cyan accent, JetBrains Mono headings,\n * Source Code Pro body — a technical, precision-first aesthetic.\n * Ideal for API docs, engineering specs, and developer-focused reports.\n */\nexport const blueprintTheme: PdfcnTheme = {\n colors: {\n accent: \"#0891b2\",\n background: \"#ffffff\",\n border: \"#cbd5e1\",\n destructive: \"#e11d48\",\n foreground: \"#0f172a\",\n info: \"#0284c7\",\n muted: \"#f1f5f9\",\n mutedForeground: \"#475569\",\n primary: \"#0f172a\",\n primaryForeground: \"#f0f9ff\",\n success: \"#059669\",\n warning: \"#d97706\",\n },\n name: \"blueprint\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 14,\n page: {\n marginBottom: 52,\n marginLeft: 48,\n marginRight: 48,\n marginTop: 52,\n },\n paragraphGap: 10,\n sectionGap: 26,\n },\n typography: {\n body: {\n fontFamily: \"Source Code Pro\",\n fontSize: 10,\n lineHeight: 1.75,\n },\n heading: {\n fontFamily: \"JetBrains Mono\",\n fontSize: {\n h1: 28,\n h2: 21,\n h3: 17,\n h4: 14,\n h5: 12,\n h6: 10,\n },\n fontWeight: 700,\n lineHeight: 1.2,\n },\n },\n};\n",
+ "content": "import type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Blueprint theme preset.\n *\n * Character: Dark slate palette with cyan accent, JetBrains Mono headings,\n * Source Code Pro body — a technical, precision-first aesthetic.\n * Ideal for API docs, engineering specs, and developer-focused reports.\n */\nexport const blueprintTheme: PdfcnTheme = {\n colors: {\n accent: \"#0891b2\",\n background: \"#ffffff\",\n border: \"#cbd5e1\",\n destructive: \"#e11d48\",\n foreground: \"#0f172a\",\n info: \"#0284c7\",\n muted: \"#f1f5f9\",\n mutedForeground: \"#475569\",\n primary: \"#0f172a\",\n primaryForeground: \"#f0f9ff\",\n success: \"#059669\",\n warning: \"#d97706\",\n },\n name: \"blueprint\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 14,\n page: {\n marginBottom: 52,\n marginLeft: 48,\n marginRight: 48,\n marginTop: 52,\n },\n paragraphGap: 10,\n sectionGap: 26,\n },\n typography: {\n body: {\n fontFamily: \"Source Code Pro\",\n fontSize: 10,\n lineHeight: 1.75,\n },\n heading: {\n fontFamily: \"JetBrains Mono\",\n fontSize: {\n h1: 28,\n h2: 21,\n h3: 17,\n h4: 14,\n h5: 12,\n h6: 10,\n },\n fontWeight: 700,\n lineHeight: 1.2,\n },\n },\n};\n",
"type": "registry:theme",
"target": "lib/pdf-themes/blueprint.ts"
},
{
"path": "registry/themes/primitives.ts",
- "content": "import type { PrimitiveTokens } from \"@/registry/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
+ "content": "import type { PrimitiveTokens } from \"@/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
"type": "registry:theme",
"target": "lib/pdf-themes/primitives.ts"
},
@@ -30,4 +30,4 @@
}
],
"type": "registry:theme"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/theme-corporate.json b/apps/web/public/r/theme-corporate.json
index 0b28521..1d29cb3 100644
--- a/apps/web/public/r/theme-corporate.json
+++ b/apps/web/public/r/theme-corporate.json
@@ -6,13 +6,13 @@
"files": [
{
"path": "registry/themes/corporate.ts",
- "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Corporate theme preset.\n *\n * Character: Blue-gray palette, Lato sans-serif throughout, structured and\n * dependable. Sky-blue accent adds clarity without distraction.\n * Ideal for business proposals, project plans, and client-facing reports.\n */\nexport const corporateTheme: PdfcnTheme = {\n colors: {\n accent: \"#0ea5e9\",\n background: \"#ffffff\",\n border: \"#e2e8f0\",\n destructive: \"#ef4444\",\n foreground: \"#1e293b\",\n info: \"#3b82f6\",\n muted: \"#f8fafc\",\n mutedForeground: \"#64748b\",\n primary: \"#0f4c81\",\n primaryForeground: \"#ffffff\",\n success: \"#22c55e\",\n warning: \"#f59e0b\",\n },\n name: \"corporate\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 13,\n page: {\n marginBottom: 52,\n marginLeft: 44,\n marginRight: 44,\n marginTop: 52,\n },\n paragraphGap: 9,\n sectionGap: 24,\n },\n typography: {\n body: {\n fontFamily: \"Lato\",\n fontSize: 11,\n lineHeight: 1.55,\n },\n heading: {\n fontFamily: \"Lato\",\n fontSize: {\n h1: 30,\n h2: 22,\n h3: 18,\n h4: 15,\n h5: 13,\n h6: 11,\n },\n fontWeight: 700,\n lineHeight: 1.2,\n },\n },\n};\n",
+ "content": "import type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Corporate theme preset.\n *\n * Character: Blue-gray palette, Lato sans-serif throughout, structured and\n * dependable. Sky-blue accent adds clarity without distraction.\n * Ideal for business proposals, project plans, and client-facing reports.\n */\nexport const corporateTheme: PdfcnTheme = {\n colors: {\n accent: \"#0ea5e9\",\n background: \"#ffffff\",\n border: \"#e2e8f0\",\n destructive: \"#ef4444\",\n foreground: \"#1e293b\",\n info: \"#3b82f6\",\n muted: \"#f8fafc\",\n mutedForeground: \"#64748b\",\n primary: \"#0f4c81\",\n primaryForeground: \"#ffffff\",\n success: \"#22c55e\",\n warning: \"#f59e0b\",\n },\n name: \"corporate\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 13,\n page: {\n marginBottom: 52,\n marginLeft: 44,\n marginRight: 44,\n marginTop: 52,\n },\n paragraphGap: 9,\n sectionGap: 24,\n },\n typography: {\n body: {\n fontFamily: \"Lato\",\n fontSize: 11,\n lineHeight: 1.55,\n },\n heading: {\n fontFamily: \"Lato\",\n fontSize: {\n h1: 30,\n h2: 22,\n h3: 18,\n h4: 15,\n h5: 13,\n h6: 11,\n },\n fontWeight: 700,\n lineHeight: 1.2,\n },\n },\n};\n",
"type": "registry:theme",
"target": "lib/pdf-themes/corporate.ts"
},
{
"path": "registry/themes/primitives.ts",
- "content": "import type { PrimitiveTokens } from \"@/registry/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
+ "content": "import type { PrimitiveTokens } from \"@/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
"type": "registry:theme",
"target": "lib/pdf-themes/primitives.ts"
},
@@ -30,4 +30,4 @@
}
],
"type": "registry:theme"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/theme-elegant.json b/apps/web/public/r/theme-elegant.json
index 76aea4b..48e0109 100644
--- a/apps/web/public/r/theme-elegant.json
+++ b/apps/web/public/r/theme-elegant.json
@@ -6,13 +6,13 @@
"files": [
{
"path": "registry/themes/elegant.ts",
- "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Elegant theme preset.\n *\n * Character: Warm cream-adjacent whites, amber/gold accent, Playfair Display\n * headings paired with Lora body — a classic editorial combination.\n * Ideal for design portfolios, luxury brands, and high-end editorial PDFs.\n */\nexport const elegantTheme: PdfcnTheme = {\n colors: {\n accent: \"#b45309\",\n background: \"#ffffff\",\n border: \"#d6d3d1\",\n destructive: \"#dc2626\",\n foreground: \"#1c1917\",\n info: \"#0ea5e9\",\n muted: \"#fafaf9\",\n mutedForeground: \"#78716c\",\n primary: \"#78350f\",\n primaryForeground: \"#fffbeb\",\n success: \"#16a34a\",\n warning: \"#d97706\",\n },\n name: \"elegant\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 16,\n page: {\n marginBottom: 60,\n marginLeft: 52,\n marginRight: 52,\n marginTop: 60,\n },\n paragraphGap: 12,\n sectionGap: 30,\n },\n typography: {\n body: {\n fontFamily: \"Lora\",\n fontSize: 11,\n lineHeight: 1.7,\n },\n heading: {\n fontFamily: \"Playfair Display\",\n fontSize: {\n h1: 36,\n h2: 26,\n h3: 20,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n fontWeight: 700,\n lineHeight: 1.2,\n },\n },\n};\n",
+ "content": "import type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Elegant theme preset.\n *\n * Character: Warm cream-adjacent whites, amber/gold accent, Playfair Display\n * headings paired with Lora body — a classic editorial combination.\n * Ideal for design portfolios, luxury brands, and high-end editorial PDFs.\n */\nexport const elegantTheme: PdfcnTheme = {\n colors: {\n accent: \"#b45309\",\n background: \"#ffffff\",\n border: \"#d6d3d1\",\n destructive: \"#dc2626\",\n foreground: \"#1c1917\",\n info: \"#0ea5e9\",\n muted: \"#fafaf9\",\n mutedForeground: \"#78716c\",\n primary: \"#78350f\",\n primaryForeground: \"#fffbeb\",\n success: \"#16a34a\",\n warning: \"#d97706\",\n },\n name: \"elegant\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 16,\n page: {\n marginBottom: 60,\n marginLeft: 52,\n marginRight: 52,\n marginTop: 60,\n },\n paragraphGap: 12,\n sectionGap: 30,\n },\n typography: {\n body: {\n fontFamily: \"Lora\",\n fontSize: 11,\n lineHeight: 1.7,\n },\n heading: {\n fontFamily: \"Playfair Display\",\n fontSize: {\n h1: 36,\n h2: 26,\n h3: 20,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n fontWeight: 700,\n lineHeight: 1.2,\n },\n },\n};\n",
"type": "registry:theme",
"target": "lib/pdf-themes/elegant.ts"
},
{
"path": "registry/themes/primitives.ts",
- "content": "import type { PrimitiveTokens } from \"@/registry/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
+ "content": "import type { PrimitiveTokens } from \"@/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
"type": "registry:theme",
"target": "lib/pdf-themes/primitives.ts"
},
@@ -30,4 +30,4 @@
}
],
"type": "registry:theme"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/theme-executive.json b/apps/web/public/r/theme-executive.json
index b88eb3b..48f9a57 100644
--- a/apps/web/public/r/theme-executive.json
+++ b/apps/web/public/r/theme-executive.json
@@ -6,13 +6,13 @@
"files": [
{
"path": "registry/themes/executive.ts",
- "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Executive theme preset.\n *\n * Character: Deep navy palette, Merriweather serif headings, Open Sans body.\n * Generous margins, high contrast, premium boardroom aesthetic.\n * Ideal for board reports, executive briefs, and investor documents.\n */\nexport const executiveTheme: PdfcnTheme = {\n colors: {\n accent: \"#1e40af\",\n background: \"#ffffff\",\n border: \"#cbd5e1\",\n destructive: \"#dc2626\",\n foreground: \"#0f172a\",\n info: \"#0369a1\",\n muted: \"#f1f5f9\",\n mutedForeground: \"#64748b\",\n primary: \"#1e3a5f\",\n primaryForeground: \"#ffffff\",\n success: \"#15803d\",\n warning: \"#b45309\",\n },\n name: \"executive\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 16,\n page: {\n marginBottom: 64,\n marginLeft: 56,\n marginRight: 56,\n marginTop: 64,\n },\n paragraphGap: 10,\n sectionGap: 32,\n },\n typography: {\n body: {\n fontFamily: \"Open Sans\",\n fontSize: 11,\n lineHeight: 1.65,\n },\n heading: {\n fontFamily: \"Merriweather\",\n fontSize: {\n h1: 34,\n h2: 26,\n h3: 20,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n fontWeight: 700,\n lineHeight: 1.25,\n },\n },\n};\n",
+ "content": "import type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Executive theme preset.\n *\n * Character: Deep navy palette, Merriweather serif headings, Open Sans body.\n * Generous margins, high contrast, premium boardroom aesthetic.\n * Ideal for board reports, executive briefs, and investor documents.\n */\nexport const executiveTheme: PdfcnTheme = {\n colors: {\n accent: \"#1e40af\",\n background: \"#ffffff\",\n border: \"#cbd5e1\",\n destructive: \"#dc2626\",\n foreground: \"#0f172a\",\n info: \"#0369a1\",\n muted: \"#f1f5f9\",\n mutedForeground: \"#64748b\",\n primary: \"#1e3a5f\",\n primaryForeground: \"#ffffff\",\n success: \"#15803d\",\n warning: \"#b45309\",\n },\n name: \"executive\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 16,\n page: {\n marginBottom: 64,\n marginLeft: 56,\n marginRight: 56,\n marginTop: 64,\n },\n paragraphGap: 10,\n sectionGap: 32,\n },\n typography: {\n body: {\n fontFamily: \"Open Sans\",\n fontSize: 11,\n lineHeight: 1.65,\n },\n heading: {\n fontFamily: \"Merriweather\",\n fontSize: {\n h1: 34,\n h2: 26,\n h3: 20,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n fontWeight: 700,\n lineHeight: 1.25,\n },\n },\n};\n",
"type": "registry:theme",
"target": "lib/pdf-themes/executive.ts"
},
{
"path": "registry/themes/primitives.ts",
- "content": "import type { PrimitiveTokens } from \"@/registry/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
+ "content": "import type { PrimitiveTokens } from \"@/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
"type": "registry:theme",
"target": "lib/pdf-themes/primitives.ts"
},
@@ -30,4 +30,4 @@
}
],
"type": "registry:theme"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/theme-forest.json b/apps/web/public/r/theme-forest.json
index 3b4655f..c3c11a0 100644
--- a/apps/web/public/r/theme-forest.json
+++ b/apps/web/public/r/theme-forest.json
@@ -6,13 +6,13 @@
"files": [
{
"path": "registry/themes/forest.ts",
- "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Forest theme preset.\n *\n * Character: Natural deep greens, Merriweather headings for gravitas, Inter\n * body for readability. Earthy and trustworthy.\n * Ideal for sustainability reports, environmental docs, and wellness brands.\n */\nexport const forestTheme: PdfcnTheme = {\n colors: {\n accent: \"#16a34a\",\n background: \"#ffffff\",\n border: \"#bbf7d0\",\n destructive: \"#dc2626\",\n foreground: \"#14532d\",\n info: \"#0ea5e9\",\n muted: \"#f0fdf4\",\n mutedForeground: \"#4d7c5f\",\n primary: \"#15803d\",\n primaryForeground: \"#ffffff\",\n success: \"#15803d\",\n warning: \"#d97706\",\n },\n name: \"forest\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 14,\n page: {\n marginBottom: 56,\n marginLeft: 48,\n marginRight: 48,\n marginTop: 56,\n },\n paragraphGap: 10,\n sectionGap: 28,\n },\n typography: {\n body: {\n fontFamily: \"Inter\",\n fontSize: 11,\n lineHeight: 1.6,\n },\n heading: {\n fontFamily: \"Merriweather\",\n fontSize: {\n h1: 32,\n h2: 24,\n h3: 19,\n h4: 15,\n h5: 13,\n h6: 11,\n },\n fontWeight: 700,\n lineHeight: 1.25,\n },\n },\n};\n",
+ "content": "import type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Forest theme preset.\n *\n * Character: Natural deep greens, Merriweather headings for gravitas, Inter\n * body for readability. Earthy and trustworthy.\n * Ideal for sustainability reports, environmental docs, and wellness brands.\n */\nexport const forestTheme: PdfcnTheme = {\n colors: {\n accent: \"#16a34a\",\n background: \"#ffffff\",\n border: \"#bbf7d0\",\n destructive: \"#dc2626\",\n foreground: \"#14532d\",\n info: \"#0ea5e9\",\n muted: \"#f0fdf4\",\n mutedForeground: \"#4d7c5f\",\n primary: \"#15803d\",\n primaryForeground: \"#ffffff\",\n success: \"#15803d\",\n warning: \"#d97706\",\n },\n name: \"forest\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 14,\n page: {\n marginBottom: 56,\n marginLeft: 48,\n marginRight: 48,\n marginTop: 56,\n },\n paragraphGap: 10,\n sectionGap: 28,\n },\n typography: {\n body: {\n fontFamily: \"Inter\",\n fontSize: 11,\n lineHeight: 1.6,\n },\n heading: {\n fontFamily: \"Merriweather\",\n fontSize: {\n h1: 32,\n h2: 24,\n h3: 19,\n h4: 15,\n h5: 13,\n h6: 11,\n },\n fontWeight: 700,\n lineHeight: 1.25,\n },\n },\n};\n",
"type": "registry:theme",
"target": "lib/pdf-themes/forest.ts"
},
{
"path": "registry/themes/primitives.ts",
- "content": "import type { PrimitiveTokens } from \"@/registry/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
+ "content": "import type { PrimitiveTokens } from \"@/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
"type": "registry:theme",
"target": "lib/pdf-themes/primitives.ts"
},
@@ -30,4 +30,4 @@
}
],
"type": "registry:theme"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/theme-minimal.json b/apps/web/public/r/theme-minimal.json
index 87eab13..e71b64a 100644
--- a/apps/web/public/r/theme-minimal.json
+++ b/apps/web/public/r/theme-minimal.json
@@ -6,13 +6,13 @@
"files": [
{
"path": "registry/themes/minimal.ts",
- "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Minimal theme preset.\n *\n * Character: Courier headings, zinc neutrals, maximum whitespace.\n * shadcn-inspired restrained palette. Ideal for clean documentation,\n * technical specs, and literary manuscripts.\n */\nexport const minimalTheme: PdfcnTheme = {\n colors: {\n accent: \"#71717a\",\n background: \"#ffffff\",\n border: \"#e4e4e7\",\n destructive: \"#b91c1c\",\n foreground: \"#18181b\",\n info: \"#0369a1\",\n muted: \"#fafafa\",\n mutedForeground: \"#a1a1aa\",\n primary: \"#18181b\",\n primaryForeground: \"#ffffff\",\n success: \"#15803d\",\n warning: \"#a16207\",\n },\n name: \"minimal\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 18,\n page: {\n marginBottom: 72,\n marginLeft: 56,\n marginRight: 56,\n marginTop: 72,\n },\n paragraphGap: 14,\n sectionGap: 36,\n },\n typography: {\n body: {\n fontFamily: \"Helvetica\",\n fontSize: 11,\n lineHeight: 1.65,\n },\n heading: {\n fontFamily: \"Courier\",\n fontSize: {\n h1: 24,\n h2: 20,\n h3: 16,\n h4: 14,\n h5: 12,\n h6: 10,\n },\n fontWeight: 600,\n lineHeight: 1.25,\n },\n },\n};\n",
+ "content": "import type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Minimal theme preset.\n *\n * Character: Courier headings, zinc neutrals, maximum whitespace.\n * shadcn-inspired restrained palette. Ideal for clean documentation,\n * technical specs, and literary manuscripts.\n */\nexport const minimalTheme: PdfcnTheme = {\n colors: {\n accent: \"#71717a\",\n background: \"#ffffff\",\n border: \"#e4e4e7\",\n destructive: \"#b91c1c\",\n foreground: \"#18181b\",\n info: \"#0369a1\",\n muted: \"#fafafa\",\n mutedForeground: \"#a1a1aa\",\n primary: \"#18181b\",\n primaryForeground: \"#ffffff\",\n success: \"#15803d\",\n warning: \"#a16207\",\n },\n name: \"minimal\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 18,\n page: {\n marginBottom: 72,\n marginLeft: 56,\n marginRight: 56,\n marginTop: 72,\n },\n paragraphGap: 14,\n sectionGap: 36,\n },\n typography: {\n body: {\n fontFamily: \"Helvetica\",\n fontSize: 11,\n lineHeight: 1.65,\n },\n heading: {\n fontFamily: \"Courier\",\n fontSize: {\n h1: 24,\n h2: 20,\n h3: 16,\n h4: 14,\n h5: 12,\n h6: 10,\n },\n fontWeight: 600,\n lineHeight: 1.25,\n },\n },\n};\n",
"type": "registry:theme",
"target": "lib/pdf-themes/minimal.ts"
},
{
"path": "registry/themes/primitives.ts",
- "content": "import type { PrimitiveTokens } from \"@/registry/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
+ "content": "import type { PrimitiveTokens } from \"@/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
"type": "registry:theme",
"target": "lib/pdf-themes/primitives.ts"
},
@@ -30,4 +30,4 @@
}
],
"type": "registry:theme"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/theme-modern.json b/apps/web/public/r/theme-modern.json
index 2d05d6a..d91d164 100644
--- a/apps/web/public/r/theme-modern.json
+++ b/apps/web/public/r/theme-modern.json
@@ -6,13 +6,13 @@
"files": [
{
"path": "registry/themes/modern.ts",
- "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Modern theme preset.\n *\n * Character: All-Helvetica, slate-cool neutrals with subtle violet accent,\n * clean spacing. shadcn-inspired contemporary feel.\n * Ideal for startups, tech companies, and design-forward documents.\n */\nexport const modernTheme: PdfcnTheme = {\n colors: {\n accent: \"#6366f1\",\n background: \"#ffffff\",\n border: \"#e2e8f0\",\n destructive: \"#ef4444\",\n foreground: \"#0f172a\",\n info: \"#3b82f6\",\n muted: \"#f1f5f9\",\n mutedForeground: \"#64748b\",\n primary: \"#334155\",\n primaryForeground: \"#ffffff\",\n success: \"#22c55e\",\n warning: \"#f59e0b\",\n },\n name: \"modern\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 12,\n page: {\n marginBottom: 40,\n marginLeft: 40,\n marginRight: 40,\n marginTop: 40,\n },\n paragraphGap: 10,\n sectionGap: 24,\n },\n typography: {\n body: {\n fontFamily: \"Helvetica\",\n fontSize: 11,\n lineHeight: 1.6,\n },\n heading: {\n fontFamily: \"Helvetica\",\n fontSize: {\n h1: 28,\n h2: 22,\n h3: 18,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n fontWeight: 600,\n lineHeight: 1.25,\n },\n },\n};\n",
+ "content": "import type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Modern theme preset.\n *\n * Character: All-Helvetica, slate-cool neutrals with subtle violet accent,\n * clean spacing. shadcn-inspired contemporary feel.\n * Ideal for startups, tech companies, and design-forward documents.\n */\nexport const modernTheme: PdfcnTheme = {\n colors: {\n accent: \"#6366f1\",\n background: \"#ffffff\",\n border: \"#e2e8f0\",\n destructive: \"#ef4444\",\n foreground: \"#0f172a\",\n info: \"#3b82f6\",\n muted: \"#f1f5f9\",\n mutedForeground: \"#64748b\",\n primary: \"#334155\",\n primaryForeground: \"#ffffff\",\n success: \"#22c55e\",\n warning: \"#f59e0b\",\n },\n name: \"modern\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 12,\n page: {\n marginBottom: 40,\n marginLeft: 40,\n marginRight: 40,\n marginTop: 40,\n },\n paragraphGap: 10,\n sectionGap: 24,\n },\n typography: {\n body: {\n fontFamily: \"Helvetica\",\n fontSize: 11,\n lineHeight: 1.6,\n },\n heading: {\n fontFamily: \"Helvetica\",\n fontSize: {\n h1: 28,\n h2: 22,\n h3: 18,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n fontWeight: 600,\n lineHeight: 1.25,\n },\n },\n};\n",
"type": "registry:theme",
"target": "lib/pdf-themes/modern.ts"
},
{
"path": "registry/themes/primitives.ts",
- "content": "import type { PrimitiveTokens } from \"@/registry/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
+ "content": "import type { PrimitiveTokens } from \"@/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
"type": "registry:theme",
"target": "lib/pdf-themes/primitives.ts"
},
@@ -30,4 +30,4 @@
}
],
"type": "registry:theme"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/theme-professional.json b/apps/web/public/r/theme-professional.json
index 741fc15..c81bcbc 100644
--- a/apps/web/public/r/theme-professional.json
+++ b/apps/web/public/r/theme-professional.json
@@ -6,13 +6,13 @@
"files": [
{
"path": "registry/themes/professional.ts",
- "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Professional theme preset.\n *\n * Character: Serif headings (Times-Roman), refined zinc/slate palette,\n * generous margins, formal document feel. shadcn-inspired minimal aesthetic.\n * Ideal for business documents, reports, and official correspondence.\n */\nexport const professionalTheme: PdfcnTheme = {\n colors: {\n accent: \"#3b82f6\",\n background: \"#ffffff\",\n border: \"#e4e4e7\",\n destructive: \"#dc2626\",\n foreground: \"#18181b\",\n info: \"#0ea5e9\",\n muted: \"#f4f4f5\",\n mutedForeground: \"#71717a\",\n primary: \"#18181b\",\n primaryForeground: \"#ffffff\",\n success: \"#16a34a\",\n warning: \"#d97706\",\n },\n name: \"professional\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 14,\n page: {\n marginBottom: 56,\n marginLeft: 48,\n marginRight: 48,\n marginTop: 56,\n },\n paragraphGap: 10,\n sectionGap: 28,\n },\n typography: {\n body: {\n fontFamily: \"Helvetica\",\n fontSize: 11,\n lineHeight: 1.6,\n },\n heading: {\n fontFamily: \"Times-Roman\",\n fontSize: {\n h1: 32,\n h2: 24,\n h3: 20,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n fontWeight: 700,\n lineHeight: 1.25,\n },\n },\n};\n",
+ "content": "import type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Professional theme preset.\n *\n * Character: Serif headings (Times-Roman), refined zinc/slate palette,\n * generous margins, formal document feel. shadcn-inspired minimal aesthetic.\n * Ideal for business documents, reports, and official correspondence.\n */\nexport const professionalTheme: PdfcnTheme = {\n colors: {\n accent: \"#3b82f6\",\n background: \"#ffffff\",\n border: \"#e4e4e7\",\n destructive: \"#dc2626\",\n foreground: \"#18181b\",\n info: \"#0ea5e9\",\n muted: \"#f4f4f5\",\n mutedForeground: \"#71717a\",\n primary: \"#18181b\",\n primaryForeground: \"#ffffff\",\n success: \"#16a34a\",\n warning: \"#d97706\",\n },\n name: \"professional\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 14,\n page: {\n marginBottom: 56,\n marginLeft: 48,\n marginRight: 48,\n marginTop: 56,\n },\n paragraphGap: 10,\n sectionGap: 28,\n },\n typography: {\n body: {\n fontFamily: \"Helvetica\",\n fontSize: 11,\n lineHeight: 1.6,\n },\n heading: {\n fontFamily: \"Times-Roman\",\n fontSize: {\n h1: 32,\n h2: 24,\n h3: 20,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n fontWeight: 700,\n lineHeight: 1.25,\n },\n },\n};\n",
"type": "registry:theme",
"target": "lib/pdf-themes/professional.ts"
},
{
"path": "registry/themes/primitives.ts",
- "content": "import type { PrimitiveTokens } from \"@/registry/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
+ "content": "import type { PrimitiveTokens } from \"@/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
"type": "registry:theme",
"target": "lib/pdf-themes/primitives.ts"
},
@@ -30,4 +30,4 @@
}
],
"type": "registry:theme"
-}
\ No newline at end of file
+}
diff --git a/apps/web/public/r/theme-vivid.json b/apps/web/public/r/theme-vivid.json
index 01f5bbc..629053e 100644
--- a/apps/web/public/r/theme-vivid.json
+++ b/apps/web/public/r/theme-vivid.json
@@ -6,13 +6,13 @@
"files": [
{
"path": "registry/themes/vivid.ts",
- "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Vivid theme preset.\n *\n * Character: Deep violet/purple palette, Nunito rounded sans-serif, playful\n * but still professional. High-energy creative accent.\n * Ideal for creative agencies, startups, marketing decks, and pitch docs.\n */\nexport const vividTheme: PdfcnTheme = {\n colors: {\n accent: \"#8b5cf6\",\n background: \"#ffffff\",\n border: \"#ddd6fe\",\n destructive: \"#dc2626\",\n foreground: \"#1e1b4b\",\n info: \"#0ea5e9\",\n muted: \"#f5f3ff\",\n mutedForeground: \"#7c3aed\",\n primary: \"#6d28d9\",\n primaryForeground: \"#ffffff\",\n success: \"#16a34a\",\n warning: \"#d97706\",\n },\n name: \"vivid\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 14,\n page: {\n marginBottom: 48,\n marginLeft: 44,\n marginRight: 44,\n marginTop: 48,\n },\n paragraphGap: 10,\n sectionGap: 26,\n },\n typography: {\n body: {\n fontFamily: \"Nunito\",\n fontSize: 11,\n lineHeight: 1.6,\n },\n heading: {\n fontFamily: \"Nunito\",\n fontSize: {\n h1: 32,\n h2: 24,\n h3: 19,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n fontWeight: 700,\n lineHeight: 1.2,\n },\n },\n};\n",
+ "content": "import type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Vivid theme preset.\n *\n * Character: Deep violet/purple palette, Nunito rounded sans-serif, playful\n * but still professional. High-energy creative accent.\n * Ideal for creative agencies, startups, marketing decks, and pitch docs.\n */\nexport const vividTheme: PdfcnTheme = {\n colors: {\n accent: \"#8b5cf6\",\n background: \"#ffffff\",\n border: \"#ddd6fe\",\n destructive: \"#dc2626\",\n foreground: \"#1e1b4b\",\n info: \"#0ea5e9\",\n muted: \"#f5f3ff\",\n mutedForeground: \"#7c3aed\",\n primary: \"#6d28d9\",\n primaryForeground: \"#ffffff\",\n success: \"#16a34a\",\n warning: \"#d97706\",\n },\n name: \"vivid\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 14,\n page: {\n marginBottom: 48,\n marginLeft: 44,\n marginRight: 44,\n marginTop: 48,\n },\n paragraphGap: 10,\n sectionGap: 26,\n },\n typography: {\n body: {\n fontFamily: \"Nunito\",\n fontSize: 11,\n lineHeight: 1.6,\n },\n heading: {\n fontFamily: \"Nunito\",\n fontSize: {\n h1: 32,\n h2: 24,\n h3: 19,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n fontWeight: 700,\n lineHeight: 1.2,\n },\n },\n};\n",
"type": "registry:theme",
"target": "lib/pdf-themes/vivid.ts"
},
{
"path": "registry/themes/primitives.ts",
- "content": "import type { PrimitiveTokens } from \"@/registry/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
+ "content": "import type { PrimitiveTokens } from \"@/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
"type": "registry:theme",
"target": "lib/pdf-themes/primitives.ts"
},
@@ -30,4 +30,4 @@
}
],
"type": "registry:theme"
-}
\ No newline at end of file
+}
diff --git a/apps/web/registry.json b/apps/web/registry.json
index 6c82c17..5d00c71 100644
--- a/apps/web/registry.json
+++ b/apps/web/registry.json
@@ -700,6 +700,7 @@
"registryDependencies": [
"@pdfcn/takumi/utils",
"@pdfcn/takumi/page-footer",
+ "@pdfcn/takumi/pdf-image",
"@pdfcn/takumi/section",
"@pdfcn/takumi/text"
],
@@ -819,6 +820,7 @@
"@pdfcn/takumi/key-value",
"@pdfcn/takumi/page-footer",
"@pdfcn/takumi/page-header",
+ "@pdfcn/takumi/page-number",
"@pdfcn/takumi/graph",
"@pdfcn/takumi/list",
"@pdfcn/takumi/section",
@@ -855,6 +857,7 @@
"@pdfcn/takumi/key-value",
"@pdfcn/takumi/page-footer",
"@pdfcn/takumi/page-header",
+ "@pdfcn/takumi/page-number",
"@pdfcn/takumi/graph",
"@pdfcn/takumi/list",
"@pdfcn/takumi/section",
@@ -891,6 +894,7 @@
"@pdfcn/takumi/key-value",
"@pdfcn/takumi/page-footer",
"@pdfcn/takumi/page-header",
+ "@pdfcn/takumi/page-number",
"@pdfcn/takumi/graph",
"@pdfcn/takumi/list",
"@pdfcn/takumi/section",
@@ -927,6 +931,7 @@
"@pdfcn/takumi/key-value",
"@pdfcn/takumi/page-footer",
"@pdfcn/takumi/page-header",
+ "@pdfcn/takumi/page-number",
"@pdfcn/takumi/graph",
"@pdfcn/takumi/list",
"@pdfcn/takumi/section",
@@ -2177,6 +2182,7 @@
"@pdfcn/forme/key-value",
"@pdfcn/forme/page-footer",
"@pdfcn/forme/page-header",
+ "@pdfcn/forme/page-number",
"@pdfcn/forme/graph",
"@pdfcn/forme/list",
"@pdfcn/forme/section",
@@ -2213,6 +2219,7 @@
"@pdfcn/forme/key-value",
"@pdfcn/forme/page-footer",
"@pdfcn/forme/page-header",
+ "@pdfcn/forme/page-number",
"@pdfcn/forme/graph",
"@pdfcn/forme/list",
"@pdfcn/forme/section",
@@ -2249,6 +2256,7 @@
"@pdfcn/forme/key-value",
"@pdfcn/forme/page-footer",
"@pdfcn/forme/page-header",
+ "@pdfcn/forme/page-number",
"@pdfcn/forme/graph",
"@pdfcn/forme/list",
"@pdfcn/forme/section",
@@ -2285,6 +2293,7 @@
"@pdfcn/forme/key-value",
"@pdfcn/forme/page-footer",
"@pdfcn/forme/page-header",
+ "@pdfcn/forme/page-number",
"@pdfcn/forme/graph",
"@pdfcn/forme/list",
"@pdfcn/forme/section",
diff --git a/apps/web/scripts/build-registry.mts b/apps/web/scripts/build-registry.mts
new file mode 100644
index 0000000..466a334
--- /dev/null
+++ b/apps/web/scripts/build-registry.mts
@@ -0,0 +1,193 @@
+import { execFileSync } from "node:child_process";
+import { readFile, writeFile } from "node:fs/promises";
+import path from "node:path";
+
+import ts from "typescript";
+
+interface RegistryFile {
+ path: string;
+ target: string;
+}
+interface RegistryItem {
+ name: string;
+ files: RegistryFile[];
+ dependencies?: string[];
+ registryDependencies?: string[];
+}
+type PublishedFile = RegistryFile & { content: string };
+type PublishedItem = Omit<RegistryItem, "files"> & { files: PublishedFile[] };
+
+const root = path.resolve(import.meta.dirname, "..");
+
+// Build the source registry before fixing import paths in its installable JSON.
+execFileSync("shadcn", ["build"], { cwd: root, stdio: "inherit" });
+
+const registry = JSON.parse(
+ await readFile(path.join(root, "registry.json"), "utf-8")
+) as { items: RegistryItem[] };
+const targets = new Map<string, string>();
+const publishedItems = new Map<string, PublishedItem>();
+
+for (const item of registry.items) {
+ for (const file of item.files) {
+ const existing = targets.get(file.path);
+ if (existing && existing !== file.target) {
+ throw new Error(`Conflicting destinations for ${file.path}`);
+ }
+ targets.set(file.path, file.target);
+ }
+}
+
+const resolveSource = (importPath: string) => {
+ const source = importPath.slice(2);
+ for (const candidate of [
+ source,
+ `${source}.ts`,
+ `${source}.tsx`,
+ `${source}/index.ts`,
+ `${source}/index.tsx`,
+ ]) {
+ if (targets.has(candidate)) {
+ return targets.get(candidate);
+ }
+ }
+ throw new Error(`No registry destination for ${importPath}`);
+};
+
+let rewritten = 0;
+for (const item of registry.items) {
+ const output = path.join(root, "public/r", `${item.name}.json`);
+ const published = JSON.parse(
+ await readFile(output, "utf-8")
+ ) as PublishedItem;
+
+ for (const file of published.files ?? []) {
+ const source = ts.createSourceFile(
+ file.path,
+ file.content,
+ ts.ScriptTarget.Latest,
+ true
+ );
+ const replacements: { start: number; end: number; value: string }[] = [];
+ const visit = (node: ts.Node) => {
+ if (
+ (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) &&
+ node.moduleSpecifier &&
+ ts.isStringLiteral(node.moduleSpecifier) &&
+ node.moduleSpecifier.text.startsWith("@/registry/")
+ ) {
+ replacements.push({
+ end: node.moduleSpecifier.getEnd() - 1,
+ start: node.moduleSpecifier.getStart(source) + 1,
+ value: `@/${resolveSource(node.moduleSpecifier.text)}`.replace(
+ /\.(tsx?|jsx?)$/,
+ ""
+ ),
+ });
+ }
+ ts.forEachChild(node, visit);
+ };
+ visit(source);
+
+ for (const { start, end, value } of replacements.toReversed()) {
+ file.content =
+ file.content.slice(0, start) + value + file.content.slice(end);
+ rewritten += 1;
+ }
+ }
+ publishedItems.set(item.name, published);
+
+ await writeFile(output, `${JSON.stringify(published, null, 2)}\n`);
+}
+
+for (const item of registry.items) {
+ const installed = new Map();
+ const packages = new Set();
+ const pending = [item.name];
+ const visited = new Set();
+
+ while (pending.length) {
+ const name = pending.pop() as string;
+ if (visited.has(name)) {
+ continue;
+ }
+ visited.add(name);
+ const dependency = publishedItems.get(name);
+ if (!dependency) {
+ throw new Error(`${item.name}: missing registry dependency ${name}`);
+ }
+
+ for (const file of dependency.files ?? []) {
+ const previous = installed.get(file.target);
+ if (previous && previous !== file.content) {
+ throw new Error(
+ `${item.name}: conflicting installed file ${file.target}`
+ );
+ }
+ installed.set(file.target, file.content);
+ }
+ for (const pkg of dependency.dependencies ?? []) {
+ packages.add(pkg);
+ }
+ for (const ref of dependency.registryDependencies ?? []) {
+ if (!ref.startsWith("@pdfcn/")) {
+ throw new Error(`${name}: unexpected registry dependency ${ref}`);
+ }
+ pending.push(ref.slice("@pdfcn/".length));
+ }
+ }
+
+ for (const [filename, content] of installed) {
+ const source = ts.createSourceFile(
+ filename,
+ content,
+ ts.ScriptTarget.Latest,
+ true
+ );
+ const visit = (node: ts.Node) => {
+ if (
+ (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) &&
+ node.moduleSpecifier &&
+ ts.isStringLiteral(node.moduleSpecifier)
+ ) {
+ const specifier = node.moduleSpecifier.text;
+ if (specifier.startsWith("@/") || specifier.startsWith(".")) {
+ const base = specifier.startsWith("@/")
+ ? specifier.slice(2)
+ : path.posix.join(path.posix.dirname(filename), specifier);
+ if (
+ ![
+ base,
+ `${base}.ts`,
+ `${base}.tsx`,
+ `${base}/index.ts`,
+ `${base}/index.tsx`,
+ ].some((candidate) => installed.has(candidate))
+ ) {
+ throw new Error(
+ `${item.name}: ${filename} imports missing ${specifier}`
+ );
+ }
+ } else if (!specifier.startsWith("node:")) {
+ const pkg = specifier.startsWith("@")
+ ? specifier.split("/").slice(0, 2).join("/")
+ : specifier.split("/")[0];
+ if (!["react", "react-dom"].includes(pkg) && !packages.has(pkg)) {
+ throw new Error(
+ `${item.name}: ${filename} requires undeclared package ${pkg}`
+ );
+ }
+ }
+ }
+ ts.forEachChild(node, visit);
+ };
+ visit(source);
+ }
+}
+
+console.log(
+ `Validated isolated install closure for ${registry.items.length} items.`
+);
+console.log(
+ `Rewrote ${rewritten} registry imports in ${registry.items.length} items.`
+);
diff --git a/apps/web/tsconfig.scripts.json b/apps/web/tsconfig.scripts.json
index 981fc58..97da65d 100644
--- a/apps/web/tsconfig.scripts.json
+++ b/apps/web/tsconfig.scripts.json
@@ -4,12 +4,13 @@
"compilerOptions": {
"target": "ES2017",
"module": "ESNext",
+ "types": ["node"],
"moduleResolution": "node",
"esModuleInterop": true,
"isolatedModules": false,
"allowImportingTsExtensions": true,
"strictNullChecks": true
},
- "include": ["scripts/**/*.{ts,mts}"],
+ "include": ["scripts/**/*.ts", "scripts/**/*.mts"],
"exclude": ["node_modules"]
}