@icanbwell/baileyai-chat-ui 1.0.28 → 1.1.0

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
@@ -399,11 +399,23 @@ By default the note only renders in the empty state, before the first message. P
399
399
 
400
400
  ## Collecting feedback
401
401
 
402
- `BaileyFeedbackButtons` renders thumbs up/down on an assistant message, with an inline form (reason chips and a comment) after a thumbs-down or an "Add a comment" click. It is opt-in and never calls an API itself: your app owns auth and networking and passes `onSubmit`/`onClear`. No extra install or subpath; it is part of the base entry.
402
+ `BaileyChatPanel` shows thumbs up/down on every completed assistant message by default, with an inline form (reason chips and a comment) after a thumbs-down or an "Add a comment" click. It works whenever `useBaileyChat` was given a `client` (the same `createBaileyClient` instance used for streaming and history): the hook exposes `chat.feedback` (`onSubmit`/`onClear`, bound to the client and the held conversation id) and the panel wires it up. Messages without a `serverMessageId` get no buttons. For the full list of options see [docs/configuration.md](docs/configuration.md#4-response-feedback).
403
+
404
+ ```tsx
405
+ const client = createBaileyClient({ baseUrl, getHeaders });
406
+ const chat = useBaileyChat({ transport: client, client, model, instructions });
407
+
408
+ <BaileyChatPanel chat={chat} /> {/* feedback on */}
409
+ <BaileyChatPanel chat={chat} feedback={false} /> {/* feedback off */}
410
+ <BaileyChatPanel chat={chat} feedback={{ reasonOptions: ['inaccurate', 'unhelpful'] }} />
411
+ ```
412
+
413
+ Hosts without a Bailey client (own networking) can render `BaileyFeedbackButtons` themselves through `renderMessageActions`, passing `onSubmit`/`onClear`. The panel detects a host-rendered `BaileyFeedbackButtons` for a message and hides its default for that message, so there is no duplicate and `feedback={false}` is not needed.
403
414
 
404
415
  ```tsx
405
416
  <BaileyChatPanel
406
417
  chat={chat}
418
+ feedback={false}
407
419
  renderMessageActions={(message) =>
408
420
  message.serverMessageId ? (
409
421
  <BaileyFeedbackButtons
@@ -432,7 +444,7 @@ Pass a stable function for `renderMessageActions`. The control renders nothing w
432
444
  - The comment is PHI-capable. It is passed to `onSubmit` only, never to the console, the trace panel or any other callback. Do not log it in your handler either.
433
445
  - Strings are overridable through the `labels` prop (`BaileyFeedbackLabels`), merged shallowly with English defaults, like `BaileyChatPanel`'s labels.
434
446
 
435
- Minimum backend: the assistant `message_id` on `response.completed` (and `X-Message-Id` for non-streaming responses) and the feedback routes from BAI-1231 (baileyai, BAI-1234). On a backend without them the buttons simply do not appear. A `503` from the feedback API means feedback is disabled for that environment; hide the control from your side for the session.
447
+ Minimum backend: the assistant `message_id` on `response.completed` (and `X-Message-Id` for non-streaming responses) and the feedback routes from BAI-1231 (baileyai, BAI-1234). On a backend without them the buttons simply do not appear. A `503` from the feedback API means feedback is disabled for that environment; with `chat.feedback` the panel then hides the buttons for the rest of that client's use. A host rendering its own `BaileyFeedbackButtons` should hide the control itself.
436
448
 
437
449
  ## Localization
438
450
 
@@ -456,25 +468,59 @@ need to supply the keys you're actually translating, the rest fall back to the E
456
468
 
457
469
  See the `BaileyChatPanelLabels` type for the full list of overridable strings.
458
470
 
459
- ## Theming
460
-
461
- The package ships CSS custom properties with sensible defaults; override any of them from your app's own CSS to match your brand:
471
+ ## Styling
472
+
473
+ Style the panel by setting CSS custom properties from your own CSS. Custom properties inherit through shadow roots, so the same approach works whether the panel renders in the page or inside a shadow DOM. Set them on `:root`, on a shadow host, or on any wrapper around the panel. Nothing is required: each token falls back to the default shown.
474
+
475
+ **Do not select `.bailey-*` classes.** They are internal and can change in any release. If you need to change something the tokens below don't cover, ask for a token or a prop instead.
476
+
477
+ Colors:
478
+
479
+ | Token | Default | Used for |
480
+ |---|---|---|
481
+ | `--color-bailey-accent` | `#4f46e5` | links, selected states, focus ring, spinners |
482
+ | `--color-bailey-bubble-bg` | `#ffffff` | user message bubble |
483
+ | `--color-bailey-text` | `#000000` | primary text |
484
+ | `--color-bailey-text-secondary` | `#6b6b6b` | secondary text, icons |
485
+ | `--color-bailey-error` | `#d32f2f` | errors, stop button |
486
+ | `--color-bailey-border` | `#e5e5e5` | borders |
487
+ | `--color-bailey-surface` | `#ffffff` | cards, input row |
488
+ | `--color-bailey-surface-muted` | `#f9fafb` | table headers, inline code, code blocks |
489
+ | `--color-bailey-page-bg` | `#eceef4` | panel background |
490
+ | `--color-bailey-heart` | `#16a34a` | send button |
491
+ | `--color-bailey-tooltip-bg` | `#000000` | tooltip background |
492
+ | `--color-bailey-tooltip-text` | `#ffffff` | tooltip text |
493
+
494
+ Typography and shape (all optional):
495
+
496
+ | Token | Default |
497
+ |---|---|
498
+ | `--bailey-font-sans` | `"Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif` |
499
+ | `--bailey-input-radius` | `9999px` |
500
+ | `--bailey-input-border-color` | `var(--color-bailey-border)` |
501
+ | `--bailey-send-fg` | `var(--color-bailey-heart)` |
502
+ | `--bailey-send-bg` | `transparent` |
503
+ | `--bailey-send-bg-hover` | `--color-bailey-heart` at 10% |
504
+ | `--bailey-stop-fg` | `var(--color-bailey-error)` |
505
+ | `--bailey-stop-bg` | `transparent` |
506
+ | `--bailey-stop-bg-hover` | `--color-bailey-error` at 10% |
507
+ | `--bailey-suggestion-radius` | `1rem` |
508
+ | `--bailey-suggestion-border` | `none` |
509
+ | `--bailey-suggestion-font-weight` | `normal` |
462
510
 
463
511
  ```css
464
- :root {
465
- --color-bailey-accent: #4f46e5;
466
- --color-bailey-bubble-bg: #e8e8e8;
467
- --color-bailey-text: #000000;
468
- --color-bailey-error: #d32f2f;
469
- --color-bailey-border: #e5e5e5;
470
- --color-bailey-surface: #ffffff;
471
- --color-bailey-surface-muted: #f9fafb;
472
- --color-bailey-text-secondary: #6b6b6b;
473
- --color-bailey-tooltip-bg: #000000;
474
- --color-bailey-tooltip-text: #ffffff;
512
+ .my-chat-wrapper {
513
+ --color-bailey-accent: #6d28d9;
514
+ --bailey-font-sans: 'Fraunces', serif;
515
+ --bailey-send-bg: #1f2937;
516
+ --bailey-send-fg: #ffffff;
475
517
  }
476
518
  ```
477
519
 
520
+ `--bailey-font-sans` is separate from `--font-sans` on purpose: a Tailwind host defines its own `--font-sans`, and the panel must not pick it up by accident.
521
+
522
+ Layout props on `BaileyChatPanel`: `suggestionsAlign` (`'start'` | `'end'`; `'end'` right-aligns the cards and anchors them to the bottom of the transcript, just above the input), an empty `labels.suggestionsTitle` (omits the title), and `hideMenuButton` (hides the "..." menu, including its "New chat" and history items, so supply your own entry points).
523
+
478
524
  The package's own `styles.css` deliberately skips Tailwind's Preflight reset, so it coexists with a host app's own base styles (e.g. MUI's `CssBaseline`) without a global collision.
479
525
 
480
526
  If your host app is itself built with Tailwind v4, import your own Tailwind stylesheet **before** `@icanbwell/baileyai-chat-ui/styles.css`: