hazo_notes 1.1.0 → 1.1.1

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.
package/README.md CHANGED
@@ -46,8 +46,15 @@ npm install hazo_connect hazo_auth hazo_logs
46
46
 
47
47
  ### 1. Add the Component
48
48
 
49
+ **Important:** You must pass your UI components via the `popover_components` or `sheet_components` prop. The component cannot auto-import these across package boundaries.
50
+
49
51
  ```tsx
50
52
  import { HazoNotesIcon } from 'hazo_notes';
53
+ // Import your shadcn/ui components
54
+ import { Popover, PopoverTrigger, PopoverContent } from '@/components/ui/popover';
55
+
56
+ // Create the components object
57
+ const popover_components = { Popover, PopoverTrigger, PopoverContent };
51
58
 
52
59
  function MyComponent() {
53
60
  return (
@@ -56,6 +63,7 @@ function MyComponent() {
56
63
  <HazoNotesIcon
57
64
  ref_id="customer-info-section"
58
65
  label="Customer Information"
66
+ popover_components={popover_components}
59
67
  />
60
68
  </div>
61
69
  );
@@ -148,6 +156,9 @@ For detailed setup instructions, see [SETUP_CHECKLIST.md](./SETUP_CHECKLIST.md).
148
156
 
149
157
  ```tsx
150
158
  import { HazoNotesIcon } from 'hazo_notes';
159
+ import { Popover, PopoverTrigger, PopoverContent } from '@/components/ui/popover';
160
+
161
+ const popover_components = { Popover, PopoverTrigger, PopoverContent };
151
162
 
152
163
  export default function FormPage() {
153
164
  return (
@@ -157,6 +168,7 @@ export default function FormPage() {
157
168
  <HazoNotesIcon
158
169
  ref_id="income-field"
159
170
  label="Annual Income"
171
+ popover_components={popover_components}
160
172
  />
161
173
  </div>
162
174
  <input type="number" name="income" />
@@ -177,6 +189,7 @@ export default function FormPage() {
177
189
  max_files_per_note={5}
178
190
  allowed_file_types={['pdf', 'docx', 'png', 'jpg']}
179
191
  max_file_size_mb={10}
192
+ popover_components={popover_components}
180
193
  />
181
194
  ```
182
195
 
@@ -188,10 +201,15 @@ export default function FormPage() {
188
201
  ### Slide Panel Style
189
202
 
190
203
  ```tsx
204
+ import { Sheet, SheetTrigger, SheetContent } from '@/components/ui/sheet';
205
+
206
+ const sheet_components = { Sheet, SheetTrigger, SheetContent };
207
+
191
208
  <HazoNotesIcon
192
209
  ref_id="detailed-notes"
193
210
  label="Detailed Notes"
194
211
  panel_style="slide_panel"
212
+ sheet_components={sheet_components}
195
213
  />
196
214
  ```
197
215
 
@@ -204,6 +222,7 @@ export default function FormPage() {
204
222
  ref_id="quick-notes"
205
223
  label="Quick Notes"
206
224
  save_mode="auto"
225
+ popover_components={popover_components}
207
226
  />
208
227
  ```
209
228
 
@@ -217,6 +236,7 @@ export default function FormPage() {
217
236
  label="Styled Notes"
218
237
  background_color="bg-blue-50"
219
238
  className="ml-2"
239
+ popover_components={popover_components}
220
240
  />
221
241
  ```
222
242
 
@@ -228,6 +248,9 @@ export default function FormPage() {
228
248
  import { useState } from 'react';
229
249
  import { HazoNotesIcon } from 'hazo_notes';
230
250
  import type { NoteEntry } from 'hazo_notes/types';
251
+ import { Popover, PopoverTrigger, PopoverContent } from '@/components/ui/popover';
252
+
253
+ const popover_components = { Popover, PopoverTrigger, PopoverContent };
231
254
 
232
255
  export default function ControlledExample() {
233
256
  const [notes, setNotes] = useState<NoteEntry[]>([]);
@@ -238,6 +261,7 @@ export default function ControlledExample() {
238
261
  label="Controlled Notes"
239
262
  notes={notes}
240
263
  on_notes_change={setNotes}
264
+ popover_components={popover_components}
241
265
  />
242
266
  );
243
267
  }
@@ -291,6 +315,18 @@ interface HazoNotesIconProps {
291
315
  // Required
292
316
  ref_id: string; // Unique identifier for this notes instance
293
317
 
318
+ // UI Components (REQUIRED - must pass one based on panel_style)
319
+ popover_components?: { // Required for panel_style="popover" (default)
320
+ Popover: React.ComponentType<any>;
321
+ PopoverTrigger: React.ComponentType<any>;
322
+ PopoverContent: React.ComponentType<any>;
323
+ };
324
+ sheet_components?: { // Required for panel_style="slide_panel"
325
+ Sheet: React.ComponentType<any>;
326
+ SheetTrigger: React.ComponentType<any>;
327
+ SheetContent: React.ComponentType<any>;
328
+ };
329
+
294
330
  // Display
295
331
  label?: string; // Panel header label
296
332
  has_notes?: boolean; // Show indicator when notes exist
@@ -567,9 +603,37 @@ Each note entry in the JSONB array:
567
603
 
568
604
  ### Notes icon doesn't open panel
569
605
 
570
- **Problem**: Icon renders but clicking does nothing.
606
+ **Problem**: Icon renders but clicking shows "Notes unavailable - pass popover_components prop" tooltip.
607
+
608
+ **Cause**: The component cannot auto-import UI components across package boundaries.
609
+
610
+ **Solution**: You must explicitly pass the UI components prop:
611
+
612
+ ```tsx
613
+ import { Popover, PopoverTrigger, PopoverContent } from '@/components/ui/popover';
614
+
615
+ const popover_components = { Popover, PopoverTrigger, PopoverContent };
616
+
617
+ <HazoNotesIcon
618
+ ref_id="my-notes"
619
+ popover_components={popover_components} // Required!
620
+ />
621
+ ```
622
+
623
+ For slide panel style, use `sheet_components` instead:
624
+ ```tsx
625
+ import { Sheet, SheetTrigger, SheetContent } from '@/components/ui/sheet';
626
+
627
+ const sheet_components = { Sheet, SheetTrigger, SheetContent };
628
+
629
+ <HazoNotesIcon
630
+ ref_id="my-notes"
631
+ panel_style="slide_panel"
632
+ sheet_components={sheet_components}
633
+ />
634
+ ```
571
635
 
572
- **Solution**: Install required UI components:
636
+ Make sure you also have the required dependencies:
573
637
  ```bash
574
638
  npm install @radix-ui/react-popover @radix-ui/react-dialog
575
639
  ```
@@ -215,8 +215,15 @@ logfile = logs/hazo_notes.log
215
215
 
216
216
  ### 8. Add the HazoNotesIcon component
217
217
 
218
+ **IMPORTANT:** You must pass the UI components via the `popover_components` or `sheet_components` prop. The component cannot auto-import these across package boundaries.
219
+
218
220
  ```tsx
219
221
  import { HazoNotesIcon } from 'hazo_notes';
222
+ // Import your shadcn/ui popover components
223
+ import { Popover, PopoverTrigger, PopoverContent } from '@/components/ui/popover';
224
+
225
+ // Create the components object once
226
+ const popover_components = { Popover, PopoverTrigger, PopoverContent };
220
227
 
221
228
  function MyComponent() {
222
229
  return (
@@ -225,12 +232,27 @@ function MyComponent() {
225
232
  <HazoNotesIcon
226
233
  ref_id="customer-info-section"
227
234
  label="Customer Information"
235
+ popover_components={popover_components} // Required!
228
236
  />
229
237
  </div>
230
238
  );
231
239
  }
232
240
  ```
233
241
 
242
+ For slide panel style, import Sheet components instead:
243
+
244
+ ```tsx
245
+ import { Sheet, SheetTrigger, SheetContent } from '@/components/ui/sheet';
246
+
247
+ const sheet_components = { Sheet, SheetTrigger, SheetContent };
248
+
249
+ <HazoNotesIcon
250
+ ref_id="field-id"
251
+ panel_style="slide_panel"
252
+ sheet_components={sheet_components} // Required for slide_panel!
253
+ />
254
+ ```
255
+
234
256
  ### 9. (Optional) Configure component props
235
257
 
236
258
  You can override config file settings via component props:
@@ -239,6 +261,7 @@ You can override config file settings via component props:
239
261
  <HazoNotesIcon
240
262
  ref_id="field-123"
241
263
  label="Customer Notes"
264
+ popover_components={popover_components} // Required!
242
265
 
243
266
  // UI configuration overrides
244
267
  panel_style="slide_panel" // 'popover' | 'slide_panel'
@@ -394,10 +417,26 @@ After setup, verify everything works:
394
417
  - Verify `@radix-ui/react-popover` or `@radix-ui/react-dialog` is installed
395
418
  - Check browser console for import errors
396
419
 
397
- ### Notes icon doesn't open panel
398
- - Verify UI components are installed: `npm install @radix-ui/react-popover @radix-ui/react-dialog`
399
- - Check that the component matches `panel_style` (popover uses `react-popover`, slide_panel uses `react-dialog`)
400
- - Look for errors in browser console
420
+ ### Notes icon doesn't open panel (shows "Notes unavailable" tooltip)
421
+ This is the most common issue. The component cannot auto-import UI components across package boundaries.
422
+
423
+ **Solution:** Pass the UI components via the `popover_components` or `sheet_components` prop:
424
+
425
+ ```tsx
426
+ import { Popover, PopoverTrigger, PopoverContent } from '@/components/ui/popover';
427
+
428
+ const popover_components = { Popover, PopoverTrigger, PopoverContent };
429
+
430
+ <HazoNotesIcon
431
+ ref_id="my-notes"
432
+ popover_components={popover_components} // This is required!
433
+ />
434
+ ```
435
+
436
+ Also verify:
437
+ - UI components are installed: `npm install @radix-ui/react-popover @radix-ui/react-dialog`
438
+ - You have shadcn/ui components at `@/components/ui/popover` (or your equivalent path)
439
+ - For slide_panel style, use `sheet_components` with Sheet components instead
401
440
 
402
441
  ### Notes not saving
403
442
  - Check that `getUserIdFromRequest` returns a valid user ID
@@ -8,7 +8,7 @@
8
8
  */
9
9
  export * from './components/index.js';
10
10
  export * from './hooks/index.js';
11
- export type { NoteFile, NoteEntry, NoteEntryDB, NewNoteInput, NoteUserInfo, HazoNotesIconProps, HazoNotesPanelProps, HazoNotesEntryProps, HazoNotesFilePreviewProps, NotesApiResponse, AddNoteApiResponse, } from './types/index.js';
11
+ export type { NoteFile, NoteEntry, NoteEntryDB, NewNoteInput, NoteUserInfo, HazoNotesIconProps, HazoNotesPanelProps, HazoNotesEntryProps, HazoNotesFilePreviewProps, NotesApiResponse, AddNoteApiResponse, PopoverComponents, SheetComponents, } from './types/index.js';
12
12
  export { LoggerProvider, use_logger, noop_logger } from './logger/index.js';
13
13
  export type { Logger, LoggerProviderProps } from './logger/index.js';
14
14
  export { cn } from './utils/cn.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../src/index.client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,cAAc,uBAAuB,CAAC;AAGtC,cAAc,kBAAkB,CAAC;AAGjC,YAAY,EACV,QAAQ,EACR,SAAS,EACT,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC5E,YAAY,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGrE,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACnC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,GACd,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../src/index.client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,cAAc,uBAAuB,CAAC;AAGtC,cAAc,kBAAkB,CAAC;AAGjC,YAAY,EACV,QAAQ,EACR,SAAS,EACT,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAElB,iBAAiB,EACjB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC5E,YAAY,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGrE,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACnC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,GACd,MAAM,uBAAuB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.client.js","sourceRoot":"","sources":["../src/index.client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,aAAa;AACb,cAAc,uBAAuB,CAAC;AAEtC,QAAQ;AACR,cAAc,kBAAkB,CAAC;AAiBjC,uBAAuB;AACvB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG5E,sBAAsB;AACtB,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACnC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,GACd,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.client.js","sourceRoot":"","sources":["../src/index.client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,aAAa;AACb,cAAc,uBAAuB,CAAC;AAEtC,QAAQ;AACR,cAAc,kBAAkB,CAAC;AAoBjC,uBAAuB;AACvB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG5E,sBAAsB;AACtB,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACnC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,GACd,MAAM,uBAAuB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hazo_notes",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Database-backed notes system with file attachment support for the hazo ecosystem",
5
5
  "type": "module",
6
6
  "main": "./dist/index.client.js",