Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
feat: prototype for puchase order pdf
Brad Barbin1b59322b6dd5
diff --git a/apps/carbon/app/routes/x+/index.tsx b/apps/carbon/app/routes/x+/index.tsxindex e30aa44cb5..f74b89a4c9 100644--- a/apps/carbon/app/routes/x+/index.tsx+++ b/apps/carbon/app/routes/x+/index.tsx@@ -1,6 +1,20 @@-import { Editor, useEditor } from "@carbon/react";+import { PurchaseOrderPDFView } from "@carbon/documents";+// import { Editor, useEditor } from "@carbon/react";export default function AppIndexRoute() {- const editor = useEditor(`<h2>Hello, World</h2><p>Welcome to Carbon!</p>`);- return <Editor editor={editor} h="calc(100vh - 98px)" />;+ // const editor = useEditor(`<h2>Hello, World</h2><p>Welcome to Carbon!</p>`);+ // return <Editor editor={editor} h="calc(100vh - 98px)" />;+ return (+ <PurchaseOrderPDFView+ company={{+ name: "The Carbon Corporation",+ logo: "https://cdn.iconscout.com/icon/free/png-256/free-framer-logo-3609961-3014601.png",+ address: "123 Main St",+ city: "New York",+ state: "NY",+ zip: "10001",+ phone: "555-555-5555",+ }}+ />+ );}diff --git a/apps/carbon/package.json b/apps/carbon/package.jsonindex 281057ee4b..da228e8341 100644--- a/apps/carbon/package.json+++ b/apps/carbon/package.json@@ -14,6 +14,7 @@},"dependencies": {"@carbon/database": "*",+ "@carbon/documents": "*","@carbon/logger": "*","@carbon/react": "*","@carbon/redis": "*",diff --git a/apps/carbon/public/fonts/Satoshi-Black.ttf b/apps/carbon/public/fonts/Satoshi-Black.ttfnew file mode 100644index 0000000000..64840c02a0Binary files /dev/null and b/apps/carbon/public/fonts/Satoshi-Black.ttf differdiff --git a/apps/carbon/public/fonts/Satoshi-Bold.ttf b/apps/carbon/public/fonts/Satoshi-Bold.ttfnew file mode 100644index 0000000000..173ea2dab4Binary files /dev/null and b/apps/carbon/public/fonts/Satoshi-Bold.ttf differdiff --git a/apps/carbon/public/fonts/Satoshi-Light.ttf b/apps/carbon/public/fonts/Satoshi-Light.ttfnew file mode 100644index 0000000000..719bcb5d51Binary files /dev/null and b/apps/carbon/public/fonts/Satoshi-Light.ttf differdiff --git a/apps/carbon/public/fonts/Satoshi-Medium.ttf b/apps/carbon/public/fonts/Satoshi-Medium.ttfnew file mode 100644index 0000000000..63208b4834Binary files /dev/null and b/apps/carbon/public/fonts/Satoshi-Medium.ttf differdiff --git a/apps/carbon/public/fonts/Satoshi-Regular.ttf b/apps/carbon/public/fonts/Satoshi-Regular.ttfnew file mode 100644index 0000000000..7f74133a64Binary files /dev/null and b/apps/carbon/public/fonts/Satoshi-Regular.ttf differdiff --git a/apps/carbon/remix.config.js b/apps/carbon/remix.config.jsindex 52f8e65e0b..76f7e06078 100644--- a/apps/carbon/remix.config.js+++ b/apps/carbon/remix.config.js@@ -8,6 +8,7 @@ module.exports = {// assetsBuildDirectory: "public/build",// publicPath: "/build/",// serverBuildPath: "build/index.js",+ browserNodeBuiltinsPolyfill: { modules: { events: true } },dev: {port: 3601,},@@ -24,6 +25,7 @@ module.exports = {},serverDependenciesToBundle: ["@carbon/database",+ "@carbon/documents","@carbon/logger","@carbon/react","@carbon/utils",@@ -32,9 +34,10 @@ module.exports = {],watchPaths: async () => {return [- "../../packages/react/src/**/*","../../packages/database/src/**/*",+ "../../packages/documents/src/**/*","../../packages/logger/src/**/*",+ "../../packages/react/src/**/*","../../packages/utils/src/**/*",];},diff --git a/package-lock.json b/package-lock.jsonindex 506f4d9c72..f7cb3bb11d 100644--- a/package-lock.json+++ b/package-lock.json@@ -32,6 +32,7 @@"license": "Apache-2.0","dependencies": {"@carbon/database": "*",+ "@carbon/documents": "*","@carbon/logger": "*","@carbon/react": "*","@carbon/redis": "*",@@ -1012,6 +1013,10 @@"resolved": "packages/database","link": true},+ "node_modules/@carbon/documents": {+ "resolved": "packages/documents",+ "link": true+ },"node_modules/@carbon/jest": {"resolved": "packages/jest","link": true@@ -4433,6 +4438,198 @@"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"}},+ "node_modules/@react-pdf/fns": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/@react-pdf/fns/-/fns-2.0.1.tgz",+ "integrity": "sha512-/vgecczzFYBQFkgUupH+sxXhLWQtBwdwCgweyh25XOlR4NZuaMD/UVUDl4loFHhRQqDMQq37lkTcchh7zzW6ug==",+ "dependencies": {+ "@babel/runtime": "^7.20.13"+ }+ },+ "node_modules/@react-pdf/font": {+ "version": "2.3.7",+ "resolved": "https://registry.npmjs.org/@react-pdf/font/-/font-2.3.7.tgz",+ "integrity": "sha512-NoCieWea6c1mCpDBoyjPbUEC1qXa+S/M7+8vYPZ71aTMgX7co3gQc2e6YKwrSQeQP+BsBq3LSVhjI2ETXfcytw==",+ "dependencies": {+ "@babel/runtime": "^7.20.13",+ "@react-pdf/types": "^2.3.4",+ "cross-fetch": "^3.1.5",+ "fontkit": "^2.0.2",+ "is-url": "^1.2.4"+ }+ },+ "node_modules/@react-pdf/image": {+ "version": "2.2.2",+ "resolved": "https://registry.npmjs.org/@react-pdf/image/-/image-2.2.2.tgz",+ "integrity": "sha512-990JvRZuhsnHyAGd7gvmhfr+4/5PAHLH9IgDstaEDLEq2eFAIQFuNM7k3D6kjKgV1mM7Jqif3CWqrcHBF3jrJw==",+ "dependencies": {+ "@babel/runtime": "^7.20.13",+ "@react-pdf/png-js": "^2.2.0",+ "cross-fetch": "^3.1.5"+ }+ },+ "node_modules/@react-pdf/layout": {+ "version": "3.6.3",+ "resolved": "https://registry.npmjs.org/@react-pdf/layout/-/layout-3.6.3.tgz",+ "integrity": "sha512-w6ACZ9o18Q5wbzsY9a4KW2Gqn6Drt3AN/kb/I6SBz/L7PAJ9rPQBIDq/s5qZJ+/WwWy33rcC8WC1givtDhjCHQ==",+ "dependencies": {+ "@babel/runtime": "^7.20.13",+ "@react-pdf/fns": "2.0.1",+ "@react-pdf/image": "^2.2.2",+ "@react-pdf/pdfkit": "^3.0.2",+ "@react-pdf/primitives": "^3.0.0",+ "@react-pdf/stylesheet": "^4.1.8",+ "@react-pdf/textkit": "^4.2.0",+ "@react-pdf/types": "^2.3.4",+ "@react-pdf/yoga": "^4.1.2",+ "cross-fetch": "^3.1.5",+ "emoji-regex": "^10.2.1",+ "queue": "^6.0.1"+ }+ },+ "node_modules/@react-pdf/layout/node_modules/emoji-regex": {+ "version": "10.3.0",+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.3.0.tgz",+ "integrity": "sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw=="+ },+ "node_modules/@react-pdf/pdfkit": {+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/@react-pdf/pdfkit/-/pdfkit-3.0.2.tgz",+ "integrity": "sha512-+m5rwNCwyEH6lmnZWpsQJvdqb6YaCCR0nMWrc/KKDwznuPMrGmGWyNxqCja+bQPORcHZyl6Cd/iFL0glyB3QGw==",+ "dependencies": {+ "@babel/runtime": "^7.20.13",+ "@react-pdf/png-js": "^2.2.0",+ "browserify-zlib": "^0.2.0",+ "crypto-js": "^4.0.0",+ "fontkit": "^2.0.2",+ "vite-compatible-readable-stream": "^3.6.1"+ }+ },+ "node_modules/@react-pdf/pdfkit/node_modules/browserify-zlib": {+ "version": "0.2.0",+ "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz",+ "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==",+ "dependencies": {+ "pako": "~1.0.5"+ }+ },+ "node_modules/@react-pdf/pdfkit/node_modules/pako": {+ "version": "1.0.11",+ "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",+ "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="+ },+ "node_modules/@react-pdf/png-js": {+ "version": "2.2.0",+ "resolved": "https://registry.npmjs.org/@react-pdf/png-js/-/png-js-2.2.0.tgz",+ "integrity": "sha512-csZU5lfNW73tq7s7zB/1rWXGro+Z9cQhxtsXwxS418TSszHUiM6PwddouiKJxdGhbVLjRIcuuFVa0aR5cDOC6w==",+ "dependencies": {+ "browserify-zlib": "^0.2.0"+ }+ },+ "node_modules/@react-pdf/png-js/node_modules/browserify-zlib": {+ "version": "0.2.0",+ "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz",+ "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==",+ "dependencies": {+ "pako": "~1.0.5"+ }+ },+ "node_modules/@react-pdf/png-js/node_modules/pako": {+ "version": "1.0.11",+ "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",+ "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="+ },+ "node_modules/@react-pdf/primitives": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/@react-pdf/primitives/-/primitives-3.0.1.tgz",+ "integrity": "sha512-0HGcknrLNwyhxe+SZCBL29JY4M85mXKdvTZE9uhjNbADGgTc8wVnkc5+e4S/lDvugbVISXyuIhZnYwtK9eDnyQ=="+ },+ "node_modules/@react-pdf/render": {+ "version": "3.2.7",+ "resolved": "https://registry.npmjs.org/@react-pdf/render/-/render-3.2.7.tgz",+ "integrity": "sha512-fAgbbAAkVL0hpcf1vUJLHxuPjPBqZuq8nors7fCwvoatBBwOWP9fza7IDPeFKN7+ZOnfmIZzes8Kc/DNHzJohw==",+ "dependencies": {+ "@babel/runtime": "^7.20.13",+ "@react-pdf/fns": "2.0.1",+ "@react-pdf/primitives": "^3.0.0",+ "@react-pdf/textkit": "^4.2.0",+ "@react-pdf/types": "^2.3.4",+ "abs-svg-path": "^0.1.1",+ "color-string": "^1.5.3",+ "normalize-svg-path": "^1.1.0",+ "parse-svg-path": "^0.1.2",+ "svg-arc-to-cubic-bezier": "^3.2.0"+ }+ },+ "node_modules/@react-pdf/renderer": {+ "version": "3.1.14",+ "resolved": "https://registry.npmjs.org/@react-pdf/renderer/-/renderer-3.1.14.tgz",+ "integrity": "sha512-Qk29uTamH6q+drK/YmiFbuQQ+yutesfIe+wyrsXFoUJUutIiDIaibO6zByMkhWb3M6CMt6NvG3NLHio1OF8U6Q==",+ "dependencies": {+ "@babel/runtime": "^7.20.13",+ "@react-pdf/font": "^2.3.7",+ "@react-pdf/layout": "^3.6.3",+ "@react-pdf/pdfkit": "^3.0.2",+ "@react-pdf/primitives": "^3.0.0",+ "@react-pdf/render": "^3.2.7",+ "@react-pdf/types": "^2.3.4",+ "events": "^3.3.0",+ "object-assign": "^4.1.1",+ "prop-types": "^15.6.2",+ "queue": "^6.0.1",+ "scheduler": "^0.17.0"+ },+ "peerDependencies": {+ "react": "^16.8.6 || ^17.0.0 || ^18.0.0"+ }+ },+ "node_modules/@react-pdf/renderer/node_modules/scheduler": {+ "version": "0.17.0",+ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.17.0.tgz",+ "integrity": "sha512-7rro8Io3tnCPuY4la/NuI5F2yfESpnfZyT6TtkXnSWVkcu0BCDJ+8gk5ozUaFaxpIyNuWAPXrH0yFcSi28fnDA==",+ "dependencies": {+ "loose-envify": "^1.1.0",+ "object-assign": "^4.1.1"+ }+ },+ "node_modules/@react-pdf/stylesheet": {+ "version": "4.1.8",+ "resolved": "https://registry.npmjs.org/@react-pdf/stylesheet/-/stylesheet-4.1.8.tgz",+ "integrity": "sha512-/EuB9RBsH3YYRj8mwzImaul619MvX3rsHNF4h8LnlwDOuBehPA3L/fHrikfPqtJvHqK2ty3GXnkw0HG5SQpMzw==",+ "dependencies": {+ "@babel/runtime": "^7.20.13",+ "@react-pdf/fns": "2.0.1",+ "@react-pdf/types": "^2.3.4",+ "color-string": "^1.5.3",+ "hsl-to-hex": "^1.0.0",+ "media-engine": "^1.0.3",+ "postcss-value-parser": "^4.1.0"+ }+ },+ "node_modules/@react-pdf/textkit": {+ "version": "4.2.0",+ "resolved": "https://registry.npmjs.org/@react-pdf/textkit/-/textkit-4.2.0.tgz",+ "integrity": "sha512-R90pEOW6NdhUx4p99iROvKmwB06IRYdXMhh0QcmUeoPOLe64ZdMfs3LZliNUWgI5fCmq71J+nv868i/EakFPDg==",+ "dependencies": {+ "@babel/runtime": "^7.20.13",+ "@react-pdf/fns": "2.0.1",+ "hyphen": "^1.6.4",+ "unicode-properties": "^1.4.1"+ }+ },+ "node_modules/@react-pdf/types": {+ "version": "2.3.4",+ "resolved": "https://registry.npmjs.org/@react-pdf/types/-/types-2.3.4.tgz",+ "integrity": "sha512-vGGz21BTE05EktBbotbd7fjC0Yi8A/lOSIpzd7L7aF1XY+vyIHlQVb35DWCipM1p/6XN4cr9etGAmm1e4Mtmjw=="+ },+ "node_modules/@react-pdf/yoga": {+ "version": "4.1.2",+ "resolved": "https://registry.npmjs.org/@react-pdf/yoga/-/yoga-4.1.2.tgz",+ "integrity": "sha512-OlMZkFrJDj4GyKZ70thiObwwPVZ52B7mlPyfzwa+sgwsioqHXg9nMWOO+7SQFNUbbOGagMUu0bCuTv+iXYZuaQ==",+ "dependencies": {+ "@babel/runtime": "^7.20.13"+ }+ },"node_modules/@react-stately/calendar": {"version": "3.4.1","resolved": "https://registry.npmjs.org/@react-stately/calendar/-/calendar-3.4.1.tgz",@@ -7986,6 +8183,11 @@"node": ">=6.5"}},+ "node_modules/abs-svg-path": {+ "version": "0.1.1",+ "resolved": "https://registry.npmjs.org/abs-svg-path/-/abs-svg-path-0.1.1.tgz",+ "integrity": "sha512-d8XPSGjfyzlXC3Xx891DJRyZfqk5JU0BJrDQcsWomFIV1/BIzPW5HDH5iDdWpqWaav0YVIEzT1RHTwWr0FFshA=="+ },"node_modules/accepts": {"version": "1.3.8","resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",@@ -8838,6 +9040,14 @@"node": ">=8"}},+ "node_modules/brotli": {+ "version": "1.3.3",+ "resolved": "https://registry.npmjs.org/brotli/-/brotli-1.3.3.tgz",+ "integrity": "sha512-oTKjJdShmDuGW94SyyaoQvAjf30dZaHnjJ8uAF+u2/vGJkJbJPJAT1gDiOJP5v1Zb6f9KEyW/1HpuaWIXtGHPg==",+ "dependencies": {+ "base64-js": "^1.1.2"+ }+ },"node_modules/browser-process-hrtime": {"version": "1.0.0","resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz",@@ -9703,6 +9913,15 @@"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz","integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="},+ "node_modules/color-string": {+ "version": "1.9.1",+ "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz",+ "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==",+ "dependencies": {+ "color-name": "^1.0.0",+ "simple-swizzle": "^0.2.2"+ }+ },"node_modules/color2k": {"version": "2.0.2","resolved": "https://registry.npmjs.org/color2k/-/color2k-2.0.2.tgz",@@ -9982,6 +10201,33 @@"yarn": ">=1"}},+ "node_modules/cross-fetch": {+ "version": "3.1.8",+ "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz",+ "integrity": "sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==",+ "dependencies": {+ "node-fetch": "^2.6.12"+ }+ },+ "node_modules/cross-fetch/node_modules/node-fetch": {+ "version": "2.7.0",+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",+ "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",+ "dependencies": {+ "whatwg-url": "^5.0.0"+ },+ "engines": {+ "node": "4.x || >=6.0.0"+ },+ "peerDependencies": {+ "encoding": "^0.1.0"+ },+ "peerDependenciesMeta": {+ "encoding": {+ "optional": true+ }+ }+ },"node_modules/cross-spawn": {"version": "7.0.3","resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",@@ -9995,6 +10241,11 @@"node": ">= 8"}},+ "node_modules/crypto-js": {+ "version": "4.2.0",+ "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz",+ "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="+ },"node_modules/css-box-model": {"version": "1.2.1","resolved": "https://registry.npmjs.org/css-box-model/-/css-box-model-1.2.1.tgz",@@ -10854,6 +11105,11 @@"url": "https://github.com/sponsors/wooorm"}},+ "node_modules/dfa": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/dfa/-/dfa-1.2.0.tgz",+ "integrity": "sha512-ED3jP8saaweFTjeGX8HQPjeC1YYyZs98jGNZx6IiBvxW7JG5v492kamAQB3m2wop07CvU/RQmzcKr6bgcC5D/Q=="+ },"node_modules/didyoumean": {"version": "1.2.2","resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz",@@ -12066,6 +12322,14 @@"integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==","dev": true},+ "node_modules/events": {+ "version": "3.3.0",+ "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",+ "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",+ "engines": {+ "node": ">=0.8.x"+ }+ },"node_modules/evt": {"version": "2.5.3","resolved": "https://registry.npmjs.org/evt/-/evt-2.5.3.tgz",@@ -12599,6 +12863,39 @@}}},+ "node_modules/fontkit": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/fontkit/-/fontkit-2.0.2.tgz",+ "integrity": "sha512-jc4k5Yr8iov8QfS6u8w2CnHWVmbOGtdBtOXMze5Y+QD966Rx6PEVWXSEGwXlsDlKtu1G12cJjcsybnqhSk/+LA==",+ "dependencies": {+ "@swc/helpers": "^0.4.2",+ "brotli": "^1.3.2",+ "clone": "^2.1.2",+ "dfa": "^1.2.0",+ "fast-deep-equal": "^3.1.3",+ "restructure": "^3.0.0",+ "tiny-inflate": "^1.0.3",+ "unicode-properties": "^1.4.0",+ "unicode-trie": "^2.0.0"+ }+ },+ "node_modules/fontkit/node_modules/@swc/helpers": {+ "version": "0.4.36",+ "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.4.36.tgz",+ "integrity": "sha512-5lxnyLEYFskErRPenYItLRSge5DjrJngYKdVjRSrWfza9G6KkgHEXi0vUZiyUeMU5JfXH1YnvXZzSp8ul88o2Q==",+ "dependencies": {+ "legacy-swc-helpers": "npm:@swc/helpers@=0.4.14",+ "tslib": "^2.4.0"+ }+ },+ "node_modules/fontkit/node_modules/clone": {+ "version": "2.1.2",+ "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz",+ "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==",+ "engines": {+ "node": ">=0.8"+ }+ },"node_modules/for-each": {"version": "0.3.3","resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",@@ -13848,6 +14145,19 @@"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz","integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw=="},+ "node_modules/hsl-to-hex": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/hsl-to-hex/-/hsl-to-hex-1.0.0.tgz",+ "integrity": "sha512-K6GVpucS5wFf44X0h2bLVRDsycgJmf9FF2elg+CrqD8GcFU8c6vYhgXn8NjUkFCwj+xDFb70qgLbTUm6sxwPmA==",+ "dependencies": {+ "hsl-to-rgb-for-reals": "^1.1.0"+ }+ },+ "node_modules/hsl-to-rgb-for-reals": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/hsl-to-rgb-for-reals/-/hsl-to-rgb-for-reals-1.1.1.tgz",+ "integrity": "sha512-LgOWAkrN0rFaQpfdWBQlv/VhkOxb5AsBjk6NQVx4yEzWS923T07X0M1Y0VNko2H52HeSpZrZNNMJ0aFqsdVzQg=="+ },"node_modules/html-encoding-sniffer": {"version": "2.0.1","resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz",@@ -13982,6 +14292,11 @@"url": "https://github.com/sponsors/typicode"}},+ "node_modules/hyphen": {+ "version": "1.9.1",+ "resolved": "https://registry.npmjs.org/hyphen/-/hyphen-1.9.1.tgz",+ "integrity": "sha512-fIPVvM6BUW+878xne+wwIcBjMxeKpoADmxNTjKMocUQWiGOvwyEfZEG95IeL/t4Su6nbfbXeYDUnz62pxzLPmw=="+ },"node_modules/iconv-lite": {"version": "0.4.24","resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",@@ -14745,6 +15060,11 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/is-url": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/is-url/-/is-url-1.2.4.tgz",+ "integrity": "sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww=="+ },"node_modules/is-weakmap": {"version": "2.0.1","resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz",@@ -16092,6 +16412,15 @@"resolved": "https://registry.npmjs.org/layout-base/-/layout-base-1.0.2.tgz","integrity": "sha512-8h2oVEZNktL4BH2JCOI90iD1yXwL6iNW7KcCKT2QZgQJR2vbqDsldCTPRU9NifTCqHZci57XvQQ15YTu+sTYPg=="},+ "node_modules/legacy-swc-helpers": {+ "name": "@swc/helpers",+ "version": "0.4.14",+ "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.4.14.tgz",+ "integrity": "sha512-4C7nX/dvpzB7za4Ql9K81xK3HPxCpHMgwTZVyf+9JQ6VUbn9jjZVN7/Nkdz/Ugzs2CSjqnL/UPXroiVBVHUWUw==",+ "dependencies": {+ "tslib": "^2.4.0"+ }+ },"node_modules/leven": {"version": "3.1.0","resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz",@@ -17032,6 +17361,11 @@"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz","integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g=="},+ "node_modules/media-engine": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/media-engine/-/media-engine-1.0.3.tgz",+ "integrity": "sha512-aa5tG6sDoK+k70B9iEX1NeyfT8ObCKhNDs6lJVpwF6r8vhUfuKMslIcirq6HIUYuuUYLefcEQOn9bSBOvawtwg=="+ },"node_modules/media-query-parser": {"version": "2.0.2","resolved": "https://registry.npmjs.org/media-query-parser/-/media-query-parser-2.0.2.tgz",@@ -18778,6 +19112,14 @@"node": ">=0.10.0"}},+ "node_modules/normalize-svg-path": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/normalize-svg-path/-/normalize-svg-path-1.1.0.tgz",+ "integrity": "sha512-r9KHKG2UUeB5LoTouwDzBy2VxXlHsiM6fyLQvnJa0S5hrhzqElH/CH7TUGhT1fVvIYBIKf3OpY4YJ4CK+iaqHg==",+ "dependencies": {+ "svg-arc-to-cubic-bezier": "^3.0.0"+ }+ },"node_modules/npm-install-checks": {"version": "6.3.0","resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-6.3.0.tgz",@@ -19628,6 +19970,11 @@"protocols": "^2.0.0"}},+ "node_modules/parse-svg-path": {+ "version": "0.1.2",+ "resolved": "https://registry.npmjs.org/parse-svg-path/-/parse-svg-path-0.1.2.tgz",+ "integrity": "sha512-JyPSBnkTJ0AI8GGJLfMXvKq42cj5c006fnLz6fXy6zfoVjJizi8BNTpu8on8ziI1cKy9d9DGNuY17Ce7wuejpQ=="+ },"node_modules/parse-url": {"version": "8.1.0","resolved": "https://registry.npmjs.org/parse-url/-/parse-url-8.1.0.tgz",@@ -20472,6 +20819,14 @@"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz","integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ=="},+ "node_modules/queue": {+ "version": "6.0.2",+ "resolved": "https://registry.npmjs.org/queue/-/queue-6.0.2.tgz",+ "integrity": "sha512-iHZWu+q3IdFZFX36ro/lKBkSvfkztY5Y7HMiPlOUjhupPcG2JMfst2KKEpu5XndviX/3UhFbRngUPNKtgvtZiA==",+ "dependencies": {+ "inherits": "~2.0.3"+ }+ },"node_modules/queue-microtask": {"version": "1.2.3","resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",@@ -21614,6 +21969,11 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/restructure": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/restructure/-/restructure-3.0.0.tgz",+ "integrity": "sha512-Xj8/MEIhhfj9X2rmD9iJ4Gga9EFqVlpMj3vfLnV2r/Mh5jRMryNV+6lWh9GdJtDBcBSPIqzRdfBQ3wDtNFv/uw=="+ },"node_modules/ret": {"version": "0.1.15","resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz",@@ -22288,6 +22648,19 @@"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz","integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="},+ "node_modules/simple-swizzle": {+ "version": "0.2.2",+ "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",+ "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==",+ "dependencies": {+ "is-arrayish": "^0.3.1"+ }+ },+ "node_modules/simple-swizzle/node_modules/is-arrayish": {+ "version": "0.3.2",+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",+ "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ=="+ },"node_modules/simple-update-notifier": {"version": "2.0.0","resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz",@@ -23163,6 +23536,11 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/svg-arc-to-cubic-bezier": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/svg-arc-to-cubic-bezier/-/svg-arc-to-cubic-bezier-3.2.0.tgz",+ "integrity": "sha512-djbJ/vZKZO+gPoSDThGNpKDO+o+bAeA4XQKovvkNCqnIS2t+S4qnLAGQhyyrulhCFRl1WWzAp0wUDV8PpTVU3g=="+ },"node_modules/symbol-tree": {"version": "3.2.4","resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",@@ -23455,6 +23833,11 @@"safe-buffer": "~5.1.0"}},+ "node_modules/tiny-inflate": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/tiny-inflate/-/tiny-inflate-1.0.3.tgz",+ "integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw=="+ },"node_modules/tiny-invariant": {"version": "1.3.1","resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.1.tgz",@@ -24602,6 +24985,24 @@"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz","integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="},+ "node_modules/unicode-properties": {+ "version": "1.4.1",+ "resolved": "https://registry.npmjs.org/unicode-properties/-/unicode-properties-1.4.1.tgz",+ "integrity": "sha512-CLjCCLQ6UuMxWnbIylkisbRj31qxHPAurvena/0iwSVbQ2G1VY5/HjV0IRabOEbDHlzZlRdCrD4NhB0JtU40Pg==",+ "dependencies": {+ "base64-js": "^1.3.0",+ "unicode-trie": "^2.0.0"+ }+ },+ "node_modules/unicode-trie": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/unicode-trie/-/unicode-trie-2.0.0.tgz",+ "integrity": "sha512-x7bc76x0bm4prf1VLg79uhAzKw8DVboClSN5VxJuQ+LKDOVEW9CdH+VY7SP+vX7xCYQqzzgQpFqz15zeLvAtZQ==",+ "dependencies": {+ "pako": "^0.2.5",+ "tiny-inflate": "^1.0.0"+ }+ },"node_modules/unified": {"version": "10.1.2","resolved": "https://registry.npmjs.org/unified/-/unified-10.1.2.tgz",@@ -25375,6 +25776,46 @@}}},+ "node_modules/vite-compatible-readable-stream": {+ "version": "3.6.1",+ "resolved": "https://registry.npmjs.org/vite-compatible-readable-stream/-/vite-compatible-readable-stream-3.6.1.tgz",+ "integrity": "sha512-t20zYkrSf868+j/p31cRIGN28Phrjm3nRSLR2fyc2tiWi4cZGVdv68yNlwnIINTkMTmPoMiSlc0OadaO7DXZaQ==",+ "dependencies": {+ "inherits": "^2.0.3",+ "string_decoder": "^1.1.1",+ "util-deprecate": "^1.0.1"+ },+ "engines": {+ "node": ">= 6"+ }+ },+ "node_modules/vite-compatible-readable-stream/node_modules/safe-buffer": {+ "version": "5.2.1",+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ]+ },+ "node_modules/vite-compatible-readable-stream/node_modules/string_decoder": {+ "version": "1.3.0",+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",+ "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",+ "dependencies": {+ "safe-buffer": "~5.2.0"+ }+ },"node_modules/vite-node": {"version": "0.28.5","resolved": "https://registry.npmjs.org/vite-node/-/vite-node-0.28.5.tgz",@@ -26476,6 +26917,29 @@"url": "https://github.com/sponsors/isaacs"}},+ "packages/documents": {+ "name": "@carbon/documents",+ "version": "0.0.0",+ "license": "Apache-2.0",+ "dependencies": {+ "@react-pdf/renderer": "^3.1.14"+ },+ "devDependencies": {+ "@carbon/database": "*",+ "@carbon/jest": "*",+ "@carbon/tsconfig": "*",+ "@testing-library/dom": "^8.11.1",+ "@types/dompurify": "^2.4.0",+ "@types/jest": "^26.0.22",+ "@types/react": "^18.0.21",+ "eslint": "^8.23.1",+ "eslint-config-carbon": "*",+ "jest": "^26.6.3",+ "react": "^18.2.0",+ "tsup": "^6.2.3",+ "typescript": "^5.2.2"+ }+ },"packages/eslint-config-carbon": {"license": "MIT","dependencies": {diff --git a/packages/database/SCHEMA.md b/packages/database/SCHEMA.mdindex f043b999b3..0f9779f08c 100644--- a/packages/database/SCHEMA.md+++ b/packages/database/SCHEMA.md@@ -1,6 +1,4 @@-# Carbon Database Schema--This file is generated by `scripts/generate-schema-md.ts` using the migrations in `packages/database/supabase/migrations`.+# Carbon Database Schema by `scripts/generate-schema-md.ts` using the migrations in `packages/database/supabase/migrations`.diff --git a/packages/documents/.eslintrc.js b/packages/documents/.eslintrc.jsnew file mode 100644index 0000000000..1308cba140--- /dev/null+++ b/packages/documents/.eslintrc.js@@ -0,0 +1,4 @@+module.exports = {+ root: true,+ extends: ["carbon"],+};diff --git a/packages/documents/README.md b/packages/documents/README.mdnew file mode 100644index 0000000000..8c09d334e6--- /dev/null+++ b/packages/documents/README.md@@ -0,0 +1,9 @@+# Carbon Documents++This package contains PDF definitions for different reports and documents used by applications. It uses the `@react-pdf/renderer` package.++## Importing Fonts++The package does not publish the fonts. Each app that uses this package is responsible for providing the Satoshi fonts at `/fonts/Satoshi-*.ttf`++See `/apps/carbon/public/fonts` for example.diff --git a/packages/documents/package.json b/packages/documents/package.jsonnew file mode 100644index 0000000000..222bf61f58--- /dev/null+++ b/packages/documents/package.json@@ -0,0 +1,41 @@+{+ "name": "@carbon/documents",+ "version": "0.0.0",+ "private": true,+ "license": "Apache-2.0",+ "sideEffects": false,+ "main": "./dist/index.js",+ "module": "./dist/index.mjs",+ "types": "./dist/index.d.ts",+ "files": [+ "dist/**"+ ],+ "scripts": {+ "build": "tsup src/index.tsx --format esm,cjs --dts --external react",+ "clean": "rimraf .turbo node_modules dist",+ "dev": "tsup src/index.tsx --format esm,cjs --watch --dts --external react",+ "lint": "TIMING=1 eslint \"src/**/*.ts*\"",+ "test": "jest"+ },+ "jest": {+ "preset": "@carbon/jest/node"+ },+ "dependencies": {+ "@react-pdf/renderer": "^3.1.14"+ },+ "devDependencies": {+ "@carbon/database": "*",+ "@carbon/jest": "*",+ "@carbon/tsconfig": "*",+ "@testing-library/dom": "^8.11.1",+ "@types/dompurify": "^2.4.0",+ "@types/jest": "^26.0.22",+ "@types/react": "^18.0.21",+ "eslint": "^8.23.1",+ "eslint-config-carbon": "*",+ "jest": "^26.6.3",+ "react": "^18.2.0",+ "tsup": "^6.2.3",+ "typescript": "^5.2.2"+ }+}diff --git a/packages/documents/src/PurchaseOrderPDF/PurchaseOrderPDF.tsx b/packages/documents/src/PurchaseOrderPDF/PurchaseOrderPDF.tsxnew file mode 100644index 0000000000..6a76079157--- /dev/null+++ b/packages/documents/src/PurchaseOrderPDF/PurchaseOrderPDF.tsx@@ -0,0 +1,229 @@+import type { Database } from "@carbon/database";+import { PDFViewer, StyleSheet, Text, View } from "@react-pdf/renderer";++import { Header, Summary, Template } from "../components";+import type { PDF } from "../types";++interface PurchaseOrderPDFProps extends PDF {+ lines?: Database["public"]["Tables"]["purchaseOrderLine"]["Row"];+}++const PurchaseOrderPDF = ({+ company,+ meta,+ title = "Purchase Order",+}: PurchaseOrderPDFProps) => {+ const styles = StyleSheet.create({+ row: {+ display: "flex",+ alignItems: "flex-start",+ flexDirection: "row",+ justifyContent: "space-between",+ marginBottom: 20,+ width: "100%",+ },+ colFull: {+ display: "flex",+ flexDirection: "column",+ rowGap: 3,+ fontSize: 11,+ fontWeight: 500,+ width: "100%",+ },+ colHalf: {+ display: "flex",+ flexDirection: "column",+ rowGap: 3,+ fontSize: 11,+ fontWeight: 500,+ width: "50%",+ },+ colThird: {+ display: "flex",+ flexDirection: "column",+ rowGap: 3,+ fontSize: 11,+ fontWeight: 500,+ width: "32%",+ },+ label: {+ color: "#7d7d7d",+ },+ total: {+ fontWeight: 700,+ color: "#000000",+ },+ table: {+ marginBottom: 20,+ },+ thead: {+ fontSize: 9,+ flexGrow: 1,+ flexDirection: "row",+ justifyContent: "space-between",+ alignItems: "center",+ marginTop: "20px",+ padding: "6px 3px 6px 3px",+ borderTop: 1,+ borderTopColor: "#CCCCCC",+ borderTopStyle: "solid",+ borderBottom: 1,+ borderBottomColor: "#CCCCCC",+ borderBottomStyle: "solid",+ fontWeight: 700,+ color: "#7d7d7d",+ textTransform: "uppercase",+ },+ tr: {+ flexGrow: 1,+ flexDirection: "row",+ justifyContent: "space-between",+ fontSize: "11px",+ padding: "15px 7px 15px 7px",+ },+ tfoot: {+ fontSize: 9,+ flexGrow: 1,+ flexDirection: "row",+ justifyContent: "space-between",+ alignItems: "center",+ marginTop: "20px",+ padding: "6px 3px 6px 3px",+ borderTop: 1,+ borderTopColor: "#CCCCCC",+ borderTopStyle: "solid",+ borderBottom: 1,+ borderBottomColor: "#CCCCCC",+ borderBottomStyle: "solid",+ fontWeight: 700,+ color: "#7d7d7d",+ textTransform: "uppercase",+ },+ });++ return (+ <Template+ title={title}+ meta={{+ author: meta?.author ?? "Carbon ERP",+ keywords: meta?.keywords ?? "purchase order",+ subject: meta?.subject ?? "Purchase Order",+ }}+ >+ <View>+ <Header title={title} company={company} />+ <Summary+ company={company}+ items={[+ {+ label: "Date",+ value: "12/3/2023",+ },+ {+ label: "PO #",+ value: "PO00000000001",+ },+ ]}+ />+ <View style={styles.row}>+ <View style={styles.colThird}>+ <Text style={styles.label}>Supplier</Text>+ <Text>John Doe</Text>+ <Text>123 Main Street</Text>+ <Text>Anytown, CA 12345</Text>+ </View>+ <View style={styles.colThird}>+ <Text style={styles.label}>Ship To</Text>+ <Text>Barry Mantelow</Text>+ <Text>123 Strange Rd</Text>+ <Text>Bazooka, AL 12345</Text>+ </View>+ </View>+ <View style={styles.row}>+ <View style={styles.colThird}>+ <Text style={styles.label}>Supplier Order #</Text>+ <Text></Text>+ </View>+ <View style={styles.colThird}>+ <Text style={styles.label}>Requested Date</Text>+ <Text>1/15/2024</Text>+ </View>+ <View style={styles.colThird}>+ <Text style={styles.label}>Promised Date</Text>+ <Text></Text>+ </View>+ </View>+ <View style={styles.row}>+ <View style={styles.colThird}>+ <Text style={styles.label}>Shipping Method</Text>+ <Text></Text>+ </View>+ <View style={styles.colThird}>+ <Text style={styles.label}>Shipping Terms</Text>+ <Text></Text>+ </View>+ <View style={styles.colThird}>+ <Text style={styles.label}>Payment Terms</Text>+ <Text>Net 30</Text>+ </View>+ </View>+ <View style={styles.table}>+ <View style={styles.thead}>+ <Text style={{ width: "40%" }}>Description</Text>+ <Text style={{ width: "20%", textAlign: "center" }}>Qty</Text>+ <Text style={{ width: "20%", textAlign: "center" }}>Price</Text>+ <Text style={{ width: "20%", textAlign: "right" }}>Total</Text>+ </View>+ {/* {lines.map(({ id, description, details, rate, quantity, amount }) => (+ <View style={styles.tr} key={id}>+ <View style={{textAlign: "left", width: "40%"}}>+ <Text style={{ marginBottom: "10" }}>{description}</Text>+ <Text style={{ fontSize: "10", opacity: 0.8, width: "95%" }}>+ {details}+ </Text>+ </View>+ <Text style={{ width: "20%", textAlign: "center" }}>+ {quantity}+ </Text>+ <Text style={{ width: "20%", textAlign: "center" }}>+ <Text>{currencySymbol}</Text>+ <Text>{rate ? rate.toFixed(2) : "0.00"}</Text>+ </Text>+ <Text style={{ width: "20%", textAlign: "right" }}>+ <Text>{currencySymbol}</Text>+ <Text>{amount}</Text>+ </Text>+ </View>+ ))} */}+ <View style={styles.tfoot}>+ <Text>Total</Text>+ <Text style={styles.total}>+ <Text>$</Text>+ <Text>49,340.32</Text>+ </Text>+ </View>+ </View>+ <View style={styles.row}>+ <View style={styles.colHalf}>+ <Text style={styles.label}>Notes</Text>+ <Text>This is a note</Text>+ </View>+ </View>+ </View>+ </Template>+ );+};++const PurchaseOrderPDFView = (props: PurchaseOrderPDFProps) => (+ <PDFViewer+ style={{+ width: "100%",+ height: "100%",+ backgroundColor: "#FFFFFF",+ }}+ >+ <PurchaseOrderPDF {...props} />+ </PDFViewer>+);++export { PurchaseOrderPDF, PurchaseOrderPDFView };diff --git a/packages/documents/src/PurchaseOrderPDF/index.ts b/packages/documents/src/PurchaseOrderPDF/index.tsnew file mode 100644index 0000000000..ebcb1c9151--- /dev/null+++ b/packages/documents/src/PurchaseOrderPDF/index.ts@@ -0,0 +1,3 @@+import { PurchaseOrderPDF, PurchaseOrderPDFView } from "./PurchaseOrderPDF";++export { PurchaseOrderPDF, PurchaseOrderPDFView };diff --git a/packages/documents/src/components/Header.tsx b/packages/documents/src/components/Header.tsxnew file mode 100644index 0000000000..81294b0a30--- /dev/null+++ b/packages/documents/src/components/Header.tsx@@ -0,0 +1,45 @@+import { Image, StyleSheet, Text, View } from "@react-pdf/renderer";+import type { Company } from "../types";++type HeaderProps = {+ company: Company;+ title: string;+};++const Header = ({ title, company }: HeaderProps) => {+ const styles = StyleSheet.create({+ header: {+ fontSize: 11,+ display: "flex",+ flexDirection: "row-reverse",+ justifyContent: "space-between",+ alignItems: "flex-start",+ marginBottom: 20,+ },+ logo: {+ height: 70,+ },+ title: {+ height: 70,+ fontSize: 26,+ fontWeight: 900,+ },+ });++ return (+ <View style={styles.header}>+ <View>+ {company.logo && (+ <View>+ <Image src={company.logo} style={styles.logo} />+ </View>+ )}+ </View>+ <View>+ <Text style={styles.title}>{title}</Text>+ </View>+ </View>+ );+};++export default Header;diff --git a/packages/documents/src/components/Summary.tsx b/packages/documents/src/components/Summary.tsxnew file mode 100644index 0000000000..9fe9f426c2--- /dev/null+++ b/packages/documents/src/components/Summary.tsx@@ -0,0 +1,82 @@+import { StyleSheet, Text, View } from "@react-pdf/renderer";+import type { Company } from "../types";++type SummaryProps = {+ company: Company;+ items: {+ label: string;+ value: string;+ }[];+};++const Summary = ({ company, items }: SummaryProps) => {+ const styles = StyleSheet.create({+ summary: {+ display: "flex",+ flexDirection: "row",+ justifyContent: "space-between",+ alignItems: "flex-start",+ marginBottom: 20,+ },+ companyDetails: {+ display: "flex",+ flexDirection: "column",+ rowGap: 3,+ fontSize: 11,+ fontWeight: 500,+ width: "68%",+ },+ companyName: {+ fontSize: 13,+ color: "#4d4d4d",+ fontWeight: 700,+ },+ documentSummary: {+ display: "flex",+ flexDirection: "column",+ rowGap: 3,+ fontSize: 11,+ fontWeight: 500,+ width: "32%",+ },+ documentSummaryItem: {+ display: "flex",+ flexDirection: "row",+ justifyContent: "flex-start",+ marginBottom: 5,+ },+ documentSummaryLabel: {+ color: "#4d4d4d",+ fontWeight: 700,+ width: "30%",+ },+ documentSummaryValue: {+ fontWeight: 500,+ },+ });++ return (+ <View style={styles.summary}>+ <View style={styles.companyDetails}>+ <Text style={styles.companyName}>{company.name}</Text>+ {company.address && <Text>{company.address}</Text>}+ {company.city && company.state && company.zip && (+ <Text>{`${company.city}, ${company.state}, ${company.zip}`}</Text>+ )}+ {company.phone && <Text>Phone: {company.phone}</Text>}+ {company.email && <Text>Email: {company.email}</Text>}+ {company.website && <Text>Website: {company.website}</Text>}+ </View>+ <View style={styles.documentSummary}>+ {items.map((item) => (+ <View key={item.label} style={styles.documentSummaryItem}>+ <Text style={styles.documentSummaryLabel}>{item.label}:</Text>+ <Text style={styles.documentSummaryValue}>{item.value}</Text>+ </View>+ ))}+ </View>+ </View>+ );+};++export default Summary;diff --git a/packages/documents/src/components/Template.tsx b/packages/documents/src/components/Template.tsxnew file mode 100644index 0000000000..fcb3e7529d--- /dev/null+++ b/packages/documents/src/components/Template.tsx@@ -0,0 +1,42 @@+import { Document, Font, Page, StyleSheet } from "@react-pdf/renderer";+import type { PropsWithChildren } from "react";+import type { Meta } from "../types";++type TemplateProps = PropsWithChildren<{ title: string; meta: Meta }>;++const Template = ({ title, meta, children }: TemplateProps) => {+ Font.register({+ family: "Satoshi",+ fonts: [+ { src: "/fonts/Satoshi-Regular.ttf" },+ { src: "/fonts/Satoshi-Light.ttf", fontWeight: 300 },+ { src: "/fonts/Satoshi-Medium.ttf", fontWeight: 500 },+ { src: "/fonts/Satoshi-Bold.ttf", fontWeight: 700 },+ { src: "/fonts/Satoshi-Black.ttf", fontWeight: 900 },+ ],+ });++ const styles = StyleSheet.create({+ body: {+ fontFamily: "Satoshi",+ padding: "20px 60px",+ color: "#000000",+ backgroundColor: "#FFFFFF",+ },+ });++ return (+ <Document+ author={meta?.author ?? "Carbon ERP"}+ keywords={meta?.keywords}+ subject={meta?.subject}+ title={title}+ >+ <Page size="A4" style={styles.body}>+ {children}+ </Page>+ </Document>+ );+};++export default Template;diff --git a/packages/documents/src/components/index.ts b/packages/documents/src/components/index.tsnew file mode 100644index 0000000000..d8b1926dc6--- /dev/null+++ b/packages/documents/src/components/index.ts@@ -0,0 +1,5 @@+import Header from "./Header";+import Summary from "./Summary";+import Template from "./Template";++export { Header, Summary, Template };diff --git a/packages/documents/src/index.tsx b/packages/documents/src/index.tsxnew file mode 100644index 0000000000..ebcb1c9151--- /dev/null+++ b/packages/documents/src/index.tsx@@ -0,0 +1,3 @@+import { PurchaseOrderPDF, PurchaseOrderPDFView } from "./PurchaseOrderPDF";++export { PurchaseOrderPDF, PurchaseOrderPDFView };diff --git a/packages/documents/src/types.ts b/packages/documents/src/types.tsnew file mode 100644index 0000000000..3620d20f6e--- /dev/null+++ b/packages/documents/src/types.ts@@ -0,0 +1,24 @@+export interface PDF {+ title?: string;+ meta?: Meta;+ company: Company;+}++export type Meta = {+ author?: string;+ keywords?: string;+ subject?: string;+};++export type Company = {+ name: string;+ logo?: string;+ address?: string;+ city?: string;+ state?: string;+ zip?: string;+ phone?: string;+ fax?: string;+ email?: string;+ website?: string;+};diff --git a/packages/documents/tsconfig.json b/packages/documents/tsconfig.jsonnew file mode 100644index 0000000000..c101e0fe04--- /dev/null+++ b/packages/documents/tsconfig.json@@ -0,0 +1,9 @@+{+ "compilerOptions": {+ "lib": ["dom", "ES2015"],+ "resolveJsonModule": true+ },+ "extends": "@carbon/tsconfig/react-library.json",+ "include": ["src"],+ "exclude": ["**/*.d.ts", "./dist", "node_modules"]+}