@papermap/papermap 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +10 -3
  2. package/readme.md +44 -44
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@papermap/papermap",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Embeddable AI chat bar and UI components from the Papermap data analytics platform",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -31,6 +31,8 @@
31
31
  "ts-check": "tsc --noEmit",
32
32
  "format": "prettier --write \"src/**/*.{ts,tsx}\"",
33
33
  "format:check": "prettier --check \"src/**/*.{ts,tsx}\"",
34
+ "test": "vitest run",
35
+ "test:watch": "vitest",
34
36
  "validate": "npm run lint && npm run ts-check",
35
37
  "validate:watch": "npm run validate -- --watch",
36
38
  "clean": "rm -rf dist styles.css",
@@ -64,7 +66,7 @@
64
66
  "@radix-ui/react-tooltip": "^1.2.8",
65
67
  "@tanstack/react-query": "^5.22.2",
66
68
  "@tanstack/react-table": "^8.21.3",
67
- "axios": "1.7.9",
69
+ "axios": "1.8.2",
68
70
  "class-variance-authority": "^0.7.1",
69
71
  "clsx": "^2.1.1",
70
72
  "framer-motion": "^11.17.0",
@@ -87,6 +89,9 @@
87
89
  "@storybook/blocks": "^8.6.14",
88
90
  "@storybook/react": "^8.6.18",
89
91
  "@storybook/react-vite": "^8.6.18",
92
+ "@testing-library/jest-dom": "^6.9.1",
93
+ "@testing-library/react": "^16.3.2",
94
+ "@testing-library/user-event": "^14.6.1",
90
95
  "@types/react": "^18.3.18",
91
96
  "@types/react-dom": "^18.3.5",
92
97
  "@types/react-syntax-highlighter": "^15.5.13",
@@ -100,6 +105,7 @@
100
105
  "eslint-plugin-react": "^7.37.4",
101
106
  "eslint-plugin-react-hooks": "^5.1.0",
102
107
  "husky": "^9.1.7",
108
+ "jsdom": "^29.0.2",
103
109
  "lint-staged": "^15.3.0",
104
110
  "playwright": "^1.58.2",
105
111
  "postcss": "^8.5.8",
@@ -111,7 +117,8 @@
111
117
  "tailwindcss-animate": "^1.0.7",
112
118
  "tsup": "^8.4.0",
113
119
  "typescript": "^5.7.3",
114
- "vite": "^6.4.1"
120
+ "vite": "^6.4.1",
121
+ "vitest": "^4.1.3"
115
122
  },
116
123
  "engines": {
117
124
  "node": ">=18"
package/readme.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Embeddable AI-powered components from the [Papermap](https://www.papermap.ai) data analytics platform. This is a standalone package — **independent** from the main Papermap app. Services, SSE streaming, and UI are self-contained; the repos do not depend on each other.
4
4
 
5
+ ## Backend setup
6
+
7
+ For **server-side setup** (HMAC auth, dashboards per tenant, embed tokens, API endpoints), see the [Backend implementation guide](https://docs.papermap.ai/documentation/multi-tenancy/backend) in the Papermap docs.
8
+
5
9
  ## Main components
6
10
 
7
11
  - **`PaperChat`** — Full AI chat assistant with streaming, conversation history, and chart generation.
@@ -73,11 +77,7 @@ import '@papermap/papermap/styles.css'
73
77
  `PapermapConfigProvider` is an alias for `PapermapProvider` — same component, useful for naming consistency in app code.
74
78
 
75
79
  ```tsx
76
- import {
77
- PapermapConfigProvider,
78
- PaperChat,
79
- PaperCard,
80
- } from '@papermap/papermap'
80
+ import { PapermapConfigProvider, PaperChat, PaperCard } from '@papermap/papermap'
81
81
 
82
82
  function App() {
83
83
  return (
@@ -125,40 +125,40 @@ function App() {
125
125
 
126
126
  #### `PaperChat` props
127
127
 
128
- | Prop | Type | Required | Default | Description |
129
- | ------------- | ---------------------- | -------- | --------------------------------- | ------------------------------------ |
130
- | `token` | `string` | Yes\* | -- | Base64-encoded API key token |
131
- | `workspaceId` | `string` | Yes\* | -- | Workspace ID |
132
- | `dashboardId` | `string` | Yes\* | -- | Dashboard ID |
133
- | `apiUrl` | `string` | No | `https://dataapi.papermap.ai` | API base URL |
134
- | `theme` | `'light' \| 'dark'` | No | -- | Force light or dark theme |
135
- | `placeholder` | `string` | No | `"Ask anything..."` | Input placeholder text |
136
- | `shortcutKey` | `string` | No | `"k"` | Keyboard shortcut (Cmd/Ctrl + key) |
137
- | `autoFade` | `boolean` | No | `false` | Fade toolbar after inactivity |
138
- | `fadeDelay` | `number` | No | `5000` | Milliseconds before auto-fade |
139
- | `className` | `string` | No | -- | Extra CSS class on toolbar container |
128
+ | Prop | Type | Required | Default | Description |
129
+ | ------------- | ------------------- | -------- | ----------------------------- | ------------------------------------ |
130
+ | `token` | `string` | Yes\* | -- | Base64-encoded API key token |
131
+ | `workspaceId` | `string` | Yes\* | -- | Workspace ID |
132
+ | `dashboardId` | `string` | Yes\* | -- | Dashboard ID |
133
+ | `apiUrl` | `string` | No | `https://dataapi.papermap.ai` | API base URL |
134
+ | `theme` | `'light' \| 'dark'` | No | -- | Force light or dark theme |
135
+ | `placeholder` | `string` | No | `"Ask anything..."` | Input placeholder text |
136
+ | `shortcutKey` | `string` | No | `"k"` | Keyboard shortcut (Cmd/Ctrl + key) |
137
+ | `autoFade` | `boolean` | No | `false` | Fade toolbar after inactivity |
138
+ | `fadeDelay` | `number` | No | `5000` | Milliseconds before auto-fade |
139
+ | `className` | `string` | No | -- | Extra CSS class on toolbar container |
140
140
 
141
141
  \*Omit on the component when values come from `PapermapConfigProvider` / `PapermapProvider`.
142
142
 
143
143
  #### `PaperCard` props
144
144
 
145
- | Prop | Type | Required | Default | Description |
146
- | -------------- | ---------------------------------------- | -------- | --------------------------------- | --------------------------------------------------------------------- |
147
- | `token` | `string` | Yes\* | -- | Base64-encoded API key token |
148
- | `workspaceId` | `string` | Yes\* | -- | Workspace ID |
149
- | `dashboardId` | `string` | Yes\* | -- | Dashboard ID |
150
- | `apiUrl` | `string` | No | `https://dataapi.papermap.ai` | API base URL |
151
- | `chartId` | `string` | No | -- | Backend chat id to load the latest chart for |
152
- | `chart` | `TChartResponse` | No | -- | Pre-loaded chart data (skips API fetch) |
153
- | `theme` | `'light' \| 'dark'` | No | -- | Force light or dark theme |
154
- | `onEditClick` | `(chartId: string) => void` | No | -- | Called when the edit button is clicked |
155
- | `onDelete` | `(chartId: string) => void` | No | -- | Called when chart deletion is confirmed |
156
- | `onPinChange` | `(chartId: string, pinned: boolean) => void` | No | -- | Called when pin state changes |
157
- | `wide` | `boolean` | No | `false` | Wide mode for table charts |
158
- | `hideVariants` | `boolean` | No | `true` | Hide the chart variation selector |
159
- | `showToolbar` | `boolean` | No | `true` | Show toolbar with maximize/edit/delete buttons |
160
- | `className` | `string` | No | -- | Extra CSS class on the card container |
161
- | `variant` | `'default' \| 'streaming'` | No | `'default'` | `'streaming'`: edit opens embedded dialog + chat |
145
+ | Prop | Type | Required | Default | Description |
146
+ | -------------- | -------------------------------------------- | -------- | ----------------------------- | ------------------------------------------------ |
147
+ | `token` | `string` | Yes\* | -- | Base64-encoded API key token |
148
+ | `workspaceId` | `string` | Yes\* | -- | Workspace ID |
149
+ | `dashboardId` | `string` | Yes\* | -- | Dashboard ID |
150
+ | `apiUrl` | `string` | No | `https://dataapi.papermap.ai` | API base URL |
151
+ | `chartId` | `string` | No | -- | Backend chat id to load the latest chart for |
152
+ | `chart` | `TChartResponse` | No | -- | Pre-loaded chart data (skips API fetch) |
153
+ | `theme` | `'light' \| 'dark'` | No | -- | Force light or dark theme |
154
+ | `onEditClick` | `(chartId: string) => void` | No | -- | Called when the edit button is clicked |
155
+ | `onDelete` | `(chartId: string) => void` | No | -- | Called when chart deletion is confirmed |
156
+ | `onPinChange` | `(chartId: string, pinned: boolean) => void` | No | -- | Called when pin state changes |
157
+ | `wide` | `boolean` | No | `false` | Wide mode for table charts |
158
+ | `hideVariants` | `boolean` | No | `true` | Hide the chart variation selector |
159
+ | `showToolbar` | `boolean` | No | `true` | Show toolbar with maximize/edit/delete buttons |
160
+ | `className` | `string` | No | -- | Extra CSS class on the card container |
161
+ | `variant` | `'default' \| 'streaming'` | No | `'default'` | `'streaming'`: edit opens embedded dialog + chat |
162
162
 
163
163
  **Pre-loaded chart:**
164
164
 
@@ -195,16 +195,16 @@ const chart: TChartResponse = {
195
195
 
196
196
  #### `PaperBoard` props (high level)
197
197
 
198
- | Prop | Notes |
199
- | ---- | ----- |
200
- | `token`, `workspaceId`, `dashboardId`, `apiUrl` | Same as other components; can come from provider. |
201
- | `charts` | Optional pre-loaded charts; otherwise fetched when `enableFetch` is true (default). |
202
- | `layouts` / `onLayoutsChange` | Controlled grid layouts per breakpoint. |
203
- | `isEditMode`, `editLayout`, `isViewer` | Edit vs view behavior. |
204
- | `showToolbar`, `showScreenshot`, `showGenerateDashboard`, `showHeader`, `showChatAssistant` | Feature toggles. |
205
- | `variant` | `'default' \| 'streaming'` for embedded chart cards (matches `PaperCard`). |
206
- | `dashboardTheme`, `onDashboardThemeChange`, `persistWorkspaceTheme`, `renderThemeModal` | Theming; built-in modal uses `ThemeCustomizationSettings`. |
207
- | Callbacks | `onEditChart`, `onDeleteChart`, `onPinChange`, `onGenerateDashboard`, `onTakeScreenshot`, `onThemeModalOpen`, etc. |
198
+ | Prop | Notes |
199
+ | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
200
+ | `token`, `workspaceId`, `dashboardId`, `apiUrl` | Same as other components; can come from provider. |
201
+ | `charts` | Optional pre-loaded charts; otherwise fetched when `enableFetch` is true (default). |
202
+ | `layouts` / `onLayoutsChange` | Controlled grid layouts per breakpoint. |
203
+ | `isEditMode`, `editLayout`, `isViewer` | Edit vs view behavior. |
204
+ | `showToolbar`, `showScreenshot`, `showGenerateDashboard`, `showHeader`, `showChatAssistant` | Feature toggles. |
205
+ | `variant` | `'default' \| 'streaming'` for embedded chart cards (matches `PaperCard`). |
206
+ | `dashboardTheme`, `onDashboardThemeChange`, `persistWorkspaceTheme`, `renderThemeModal` | Theming; built-in modal uses `ThemeCustomizationSettings`. |
207
+ | Callbacks | `onEditChart`, `onDeleteChart`, `onPinChange`, `onGenerateDashboard`, `onTakeScreenshot`, `onThemeModalOpen`, etc. |
208
208
 
209
209
  See TypeScript types `PaperBoardProps` and Storybook stories for full detail.
210
210