@thewhatmatters/wmds 0.3.0 → 0.4.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/CHANGELOG.md +19 -0
- package/CONSUMING.md +2 -1
- package/dist/components/molecules/PromptBar/PromptBar.d.ts +11 -1
- package/dist/components/molecules/PromptBar/PromptBar.d.ts.map +1 -1
- package/dist/components/molecules/PromptBar/PromptBar.js +54 -43
- package/dist/components/molecules/PromptBar/promptBarStyles.d.ts +15 -0
- package/dist/components/molecules/PromptBar/promptBarStyles.d.ts.map +1 -1
- package/dist/components/molecules/PromptBar/promptBarStyles.js +5 -2
- package/dist/components/organisms/ChatDock/ChatDock.d.ts +93 -0
- package/dist/components/organisms/ChatDock/ChatDock.d.ts.map +1 -0
- package/dist/components/organisms/ChatDock/ChatDock.js +255 -0
- package/dist/components/organisms/ChatDock/chatDockStyles.d.ts +48 -0
- package/dist/components/organisms/ChatDock/chatDockStyles.d.ts.map +1 -0
- package/dist/components/organisms/ChatDock/chatDockStyles.js +15 -0
- package/dist/components/organisms/Dialog/AlertDialog.js +11 -11
- package/dist/components/organisms/Dialog/Dialog.js +44 -44
- package/dist/components/organisms/Sheet/Sheet.js +38 -38
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -28
- package/dist/styles.css +1 -1
- package/docs/component-contracts.md +1 -1
- package/docs/components.md +3 -2
- package/docs/exports.json +14 -2
- package/docs/patterns/components-avatar--dropdown-row.tsx +1 -1
- package/docs/patterns/components-badge--with-avatar.tsx +1 -1
- package/docs/patterns/components-button-button--destructive-action.tsx +1 -1
- package/docs/patterns/components-button-button--ghost-action.tsx +1 -1
- package/docs/patterns/components-button-button--inverse-action.tsx +1 -1
- package/docs/patterns/components-button-button--link-render.tsx +1 -1
- package/docs/patterns/components-button-button--multi-state-badge.tsx +1 -1
- package/docs/patterns/components-button-button--outline-mono.tsx +1 -1
- package/docs/patterns/components-button-button--primary-action.tsx +1 -1
- package/docs/patterns/components-button-button--row-hug.tsx +1 -1
- package/docs/patterns/components-button-button--row-layout.tsx +1 -1
- package/docs/patterns/components-button-button--secondary-action.tsx +1 -1
- package/docs/patterns/components-button-button--suggestion-pills.tsx +1 -1
- package/docs/patterns/components-button-button--with-count.tsx +1 -1
- package/docs/patterns/components-button-button--with-icon.tsx +1 -1
- package/docs/patterns/components-button-floatingactionbutton--vertical-actions.tsx +1 -1
- package/docs/patterns/components-calembed--pattern-skip-in-footer.tsx +1 -1
- package/docs/patterns/components-card-card--body-slot-occupancy-history.tsx +1 -1
- package/docs/patterns/components-card-card--headerless-media.tsx +1 -1
- package/docs/patterns/components-card-card--outlined-layout.tsx +1 -1
- package/docs/patterns/components-card-card--pinned-height.tsx +1 -1
- package/docs/patterns/components-card-selectablecard--selectable-cards-pattern.tsx +1 -1
- package/docs/patterns/components-chart--audience-activity-heatmap.tsx +1 -1
- package/docs/patterns/components-chart--cartesian-no-data-gaps.tsx +1 -1
- package/docs/patterns/components-chart--occupancy-history-in-card.tsx +1 -1
- package/docs/patterns/components-chart--occupancy-in-card.tsx +1 -1
- package/docs/patterns/components-chart--post-reach-distribution.tsx +1 -1
- package/docs/patterns/components-chart--ranked-audience-breakdown.tsx +1 -1
- package/docs/patterns/components-chart--unit-grid-composition.tsx +1 -1
- package/docs/patterns/components-chatdock--pattern-chat-dock.tsx +68 -0
- package/docs/patterns/components-chatqa--pattern-qa-with-reply.tsx +1 -1
- package/docs/patterns/components-checkbox-checkbox--default.tsx +1 -1
- package/docs/patterns/components-checkbox-checkbox--with-description.tsx +1 -1
- package/docs/patterns/components-checkbox-checkboxgroup--default.tsx +1 -1
- package/docs/patterns/components-dialog--alert-dialog-destructive.tsx +1 -1
- package/docs/patterns/components-dialog--default-dialog.tsx +1 -1
- package/docs/patterns/components-dialog--form-dialog.tsx +1 -1
- package/docs/patterns/components-displaycontrols--page-utilities.tsx +1 -1
- package/docs/patterns/components-field--horizontal-input.tsx +1 -1
- package/docs/patterns/components-field--horizontal-text-area.tsx +1 -1
- package/docs/patterns/components-field--multi-control.tsx +1 -1
- package/docs/patterns/components-footerreveal--marketing-hero-pattern.tsx +1 -1
- package/docs/patterns/components-footerreveal--marketing-hero-ruled-pattern.tsx +1 -1
- package/docs/patterns/components-footerreveal--marketing-hero-with-gallery-intro.tsx +1 -1
- package/docs/patterns/components-footerreveal--marketing-page-pattern.tsx +1 -1
- package/docs/patterns/components-footerreveal--ruled-grid-footer-pattern.tsx +1 -1
- package/docs/patterns/components-footerreveal--sequenced-marketing-hero.tsx +1 -1
- package/docs/patterns/components-herointro--two-line-intro.tsx +1 -1
- package/docs/patterns/components-herotilestack--marketing-hero-pattern.tsx +1 -1
- package/docs/patterns/components-herotilestack--marketing-hero-text-sequence.tsx +1 -1
- package/docs/patterns/components-herotilestack--marketing-hero-with-gallery-intro.tsx +1 -1
- package/docs/patterns/components-intakeconfirmation--booked-pattern.tsx +1 -1
- package/docs/patterns/components-intakeconfirmation--emailed-pattern.tsx +1 -1
- package/docs/patterns/components-intakeform--about-you-pattern.tsx +1 -1
- package/docs/patterns/components-intakemodal--intake-modal-pattern.tsx +1 -1
- package/docs/patterns/components-kbd--command-row.tsx +1 -1
- package/docs/patterns/components-kbd--numbered-choices.tsx +1 -1
- package/docs/patterns/components-kbd--shortcut.tsx +1 -1
- package/docs/patterns/components-moremenu--action-menu.tsx +1 -1
- package/docs/patterns/components-moremenu--in-card-header.tsx +1 -1
- package/docs/patterns/components-navlist--side-nav-settings.tsx +1 -1
- package/docs/patterns/components-pageheader--app-header-pattern.tsx +1 -1
- package/docs/patterns/components-pageheader--page-section-header.tsx +1 -1
- package/docs/patterns/components-pageheader--toolbar-header.tsx +1 -1
- package/docs/patterns/components-panel--end-detail-rail.tsx +1 -1
- package/docs/patterns/components-pillgroup--pill-group-pattern.tsx +1 -1
- package/docs/patterns/components-promptbar--pattern-prompt-bar.tsx +1 -1
- package/docs/patterns/components-radio-radiogroup--default.tsx +1 -1
- package/docs/patterns/components-scrollhorizontal--project-gallery-pattern.tsx +1 -1
- package/docs/patterns/components-scrollhorizontal--with-intro.tsx +1 -1
- package/docs/patterns/components-sheet--bottom-sheet.tsx +1 -1
- package/docs/patterns/components-sheet--end-sheet.tsx +1 -1
- package/docs/patterns/components-sitenav--brand-and-cta.tsx +1 -1
- package/docs/patterns/components-sitenav--centered-links.tsx +1 -1
- package/docs/patterns/components-sitenav--compact.tsx +1 -1
- package/docs/patterns/components-sitenav--marketing-header.tsx +1 -1
- package/docs/patterns/components-sitenav--mega-menu.tsx +1 -1
- package/docs/patterns/components-stat--insights-row.tsx +1 -1
- package/docs/patterns/components-stepprogress--step-progress-pattern.tsx +1 -1
- package/docs/patterns/components-switch--default.tsx +1 -1
- package/docs/patterns/components-switch--settings-row.tsx +1 -1
- package/docs/patterns/components-tab--settings-pages.tsx +1 -1
- package/docs/patterns/components-taskrows--action-details.tsx +1 -1
- package/docs/patterns/components-taskrows--capsules.tsx +1 -1
- package/docs/patterns/components-taskrows--card-with-status-rows.tsx +1 -1
- package/docs/patterns/components-taskrows--controlled-expand.tsx +1 -1
- package/docs/patterns/components-taskrows--custom-slots.tsx +1 -1
- package/docs/patterns/components-taskrows--status-list.tsx +1 -1
- package/docs/patterns/components-taskrows--tag-chips.tsx +1 -1
- package/docs/patterns/components-textlink--external-destination.tsx +1 -1
- package/docs/patterns/components-textlink--inline-prose.tsx +1 -1
- package/docs/patterns/components-textlink--supporting-copy.tsx +1 -1
- package/docs/patterns/components-textsequence--default.tsx +1 -1
- package/docs/patterns/components-textsequence--reduced-motion.tsx +1 -1
- package/docs/patterns/components-textsequence--shapes.tsx +1 -1
- package/docs/patterns/components-toast--stacked-notifications.tsx +1 -1
- package/docs/patterns/components-tooltip--controlled.tsx +1 -1
- package/docs/patterns/components-tooltip--disabled-control.tsx +1 -1
- package/docs/patterns/components-tooltip--icon-action.tsx +1 -1
- package/docs/patterns/components-tooltip--keyboard-shortcut.tsx +1 -1
- package/docs/patterns/components-tooltip--placement.tsx +1 -1
- package/docs/patterns/foundations-scroll-fade--horizontal-rail.tsx +1 -1
- package/docs/patterns/foundations-scroll-fade--overflowing-list.tsx +1 -1
- package/docs/patterns/guides-chart-explorations--comparison-gallery.tsx +1 -1
- package/docs/patterns/guides-overlay-flows--notification-preferences.tsx +1 -1
- package/docs/patterns/guides-profile-typography--editorial-profile.tsx +1 -1
- package/docs/patterns/index.json +9 -9
- package/package.json +1 -1
- package/docs/patterns/components-promptbar--pattern-marketing-composer.tsx +0 -37
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,25 @@ Every release of `@thewhatmatters/wmds` is listed here, newest first.
|
|
|
7
7
|
- **Pasted patterns:** when a release changes a **Pattern — …** story's Show code, it is named under Consumer actions so apps re-copy it.
|
|
8
8
|
- **How to add an entry** (contributors): add your change to the top entry. If that version is already on npm (`npm view @thewhatmatters/wmds versions`), start a new entry above it and bump `version` in `package.json` to match. `npm run check:changelog` enforces the format.
|
|
9
9
|
|
|
10
|
+
## 0.4.0
|
|
11
|
+
|
|
12
|
+
**ChatDock** is the site assistant: a pinned composer that shows suggested questions on hover and opens into a chat window, instead of a separate ask page. **PromptBar** gains `start` and `end` slots. **Components/PromptBar → Pattern — marketing composer** is removed. See **ADR-0039**.
|
|
13
|
+
|
|
14
|
+
### Consumer actions
|
|
15
|
+
|
|
16
|
+
1. **Replace the marketing composer and the ask page with ChatDock** (the WhatMatters site). Paste **Components/ChatDock → Pattern — chat dock** (`node_modules/@thewhatmatters/wmds/docs/patterns/components-chatdock--pattern-chat-dock.tsx`), pass your assistant request as `ask` and open **IntakeModal** from `onStartProject`, and mount it once in the marketing layout. Then delete the pasted **Pattern — marketing composer** (`npx wmds-check` reports it as `pattern-removed`), the ask page component (`components/ask-what-matters.tsx`), and its `/ask` route. Redirect `/ask` to the homepage if it has inbound links.
|
|
17
|
+
2. **Reply content is yours to render.** `messages[].content` takes text or Markdown your app has already rendered; WMDS does not parse Markdown.
|
|
18
|
+
3. **No other changes.** **PromptBar**'s new `start` and `end` props are optional; existing bars render as before.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **ChatDock** (`ChatDock`, `chatDockDefaultLabels`, `chatDockPlacements`, and the `ChatDock*` types).
|
|
23
|
+
- **PromptBar** `start` (brand mark) and `end` (extra inset controls before send).
|
|
24
|
+
|
|
25
|
+
### Removed
|
|
26
|
+
|
|
27
|
+
- **Components/PromptBar → Pattern — marketing composer**.
|
|
28
|
+
|
|
10
29
|
## 0.3.0
|
|
11
30
|
|
|
12
31
|
Storybook no longer mirrors product sites. The **Sites/** section (WhatMatters and PitchKit pages) is removed, and so are its `sites-…` files in `docs/patterns/`. No component, prop, token, or export changed.
|
package/CONSUMING.md
CHANGED
|
@@ -264,7 +264,8 @@ import {
|
|
|
264
264
|
| `Chip` | `size`, `value`, `selected`, `onRemove`, `icon`, `count`, `readOnly` | Components/Chip — use `ChipFilterGroup` for multi-select filters |
|
|
265
265
|
| `Input` | `label`, `description`, `status`, `message`, `loading`, `endBadge`, `icon`, `size` | Components/Input — pill shell; Required via `endBadge={<Badge>…</Badge>}` |
|
|
266
266
|
| `Search` | `size`, `placeholder`, `onSubmit` | Components/Search — inline input + button row |
|
|
267
|
-
| `PromptBar` | `value`, `onValueChange`, `onSend`, `placeholder` (default Ask anything…) | Components/PromptBar — **Pattern — prompt bar**. Wide pill, inline field (one line empty, up to 3 lines, then scroll), inset **IconButton** send. Muted until there is text, then `--color-brand` (`#011272`). Enter sends.
|
|
267
|
+
| `PromptBar` | `value`, `onValueChange`, `onSend`, `placeholder` (default Ask anything…), `start`, `end` | Components/PromptBar — **Pattern — prompt bar**. Wide pill, inline field (one line empty, up to 3 lines, then scroll), inset **IconButton** send. Muted until there is text, then `--color-brand` (`#011272`). Enter sends. `start` takes the brand mark; `end` takes extra inset controls. Voice and attachments are not part of this version. |
|
|
268
|
+
| `ChatDock` | `title`, `subtitle`, `mark`, `greeting`, `messages`, `thinking`, `suggestions`, `onSend`, `onSuggestionSelect`, `disclaimer` | Components/ChatDock — **Pattern — chat dock**. The site assistant: a pinned **PromptBar** with suggested-question pills on hover that opens into a non-modal chat window (full screen on phones). The app owns the conversation and the request. Replaces the separate ask page. |
|
|
268
269
|
| `Card` | `variant`, `shape`, `padding` | Components/Card/Card — `Card.Header` (`start` | `end`), **`Card.Body` slot** (no default fill), `Card.Footer` |
|
|
269
270
|
| `Accordion` | `variant`, `Accordion.Item` `leading` / `label` / `trailing` / `open` | Components/Accordion — FAQ, settings sections |
|
|
270
271
|
| `TaskRows` | `variant`, `status`, `meta`, `detailsLayout`, `TaskRows.Detail` | Components/TaskRows — **Pattern — status rows**, **capsules**, **action details** (`Detail variant="button"`), **tag chips** (`Chip readOnly size="sm"`), detail lines (`Detail` + `onPress` → `Button layout="row"`) |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TextareaHTMLAttributes } from "react";
|
|
1
|
+
import { type ReactNode, type TextareaHTMLAttributes } from "react";
|
|
2
2
|
/** Layout-only — width, margin, flex placement. Not for colors. */
|
|
3
3
|
export type PromptBarLayoutClassName = string;
|
|
4
4
|
export declare const promptBarPlaceholder = "Ask anything\u2026";
|
|
@@ -21,6 +21,16 @@ export interface PromptBarProps extends Omit<TextareaHTMLAttributes<HTMLTextArea
|
|
|
21
21
|
/** Accessible name for the send control. Default: "Send". */
|
|
22
22
|
sendLabel?: string;
|
|
23
23
|
disabled?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Leading slot inside the pill — a brand mark or **Avatar** `sm` (2.25rem). Decorative or
|
|
26
|
+
* labeled by the caller; not a control.
|
|
27
|
+
*/
|
|
28
|
+
start?: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Extra inset controls before send — for example a mic **IconButton** `sm` `role="secondary"`.
|
|
31
|
+
* The caller owns the handler and accessible name.
|
|
32
|
+
*/
|
|
33
|
+
end?: ReactNode;
|
|
24
34
|
className?: PromptBarLayoutClassName;
|
|
25
35
|
}
|
|
26
36
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromptBar.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/PromptBar/PromptBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,sBAAsB,EAC5B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PromptBar.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/PromptBar/PromptBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,sBAAsB,EAC5B,MAAM,OAAO,CAAC;AAgBf,mEAAmE;AACnE,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAE9C,eAAO,MAAM,oBAAoB,uBAAkB,CAAC;AAEpD,MAAM,WAAW,cACf,SAAQ,IAAI,CACV,sBAAsB,CAAC,mBAAmB,CAAC,EAC3C,UAAU,GAAG,WAAW,GAAG,cAAc,GAAG,UAAU,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CACnG;IACD,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0BAA0B;IAC1B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,+BAA+B;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,SAAS,CAAC,EAAE,wBAAwB,CAAC;CACtC;AAMD;;;;;GAKG;AACH,eAAO,MAAM,SAAS,gHAqFpB,CAAC"}
|
|
@@ -2,55 +2,66 @@
|
|
|
2
2
|
import { cn as e } from "../../../lib/cn.js";
|
|
3
3
|
import { IconButton as t } from "../../atoms/IconButton/IconButton.js";
|
|
4
4
|
import { TextArea as n } from "../../atoms/TextArea/TextArea.js";
|
|
5
|
-
import {
|
|
6
|
-
import { forwardRef as
|
|
7
|
-
import { ArrowRight as
|
|
8
|
-
import { jsx as
|
|
5
|
+
import { promptBarEndSlotClasses as r, promptBarFieldClasses as i, promptBarSendClasses as a, promptBarSendMutedClasses as o, promptBarSendReadyClasses as s, promptBarShellClasses as c, promptBarShellStartPadClasses as l, promptBarStartSlotClasses as u } from "./promptBarStyles.js";
|
|
6
|
+
import { forwardRef as d, useState as f } from "react";
|
|
7
|
+
import { ArrowRight as p } from "lucide-react";
|
|
8
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/molecules/PromptBar/PromptBar.tsx
|
|
10
|
-
var
|
|
11
|
-
function
|
|
10
|
+
var g = "Ask anything…";
|
|
11
|
+
function _(e) {
|
|
12
12
|
return e.trim().length > 0;
|
|
13
13
|
}
|
|
14
|
-
var
|
|
15
|
-
let
|
|
16
|
-
function
|
|
17
|
-
|
|
14
|
+
var v = d(function({ value: d, defaultValue: v = "", onValueChange: y, onSend: b, placeholder: x = g, "aria-label": S = "Ask anything", sendLabel: C = "Send", disabled: w = !1, start: T, end: E, className: D, onKeyDown: O, ...k }, A) {
|
|
15
|
+
let j = d !== void 0, [M, N] = f(v), P = j ? d : M, F = !w && _(P);
|
|
16
|
+
function I(e) {
|
|
17
|
+
j || N(e), y?.(e);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
19
|
+
function L() {
|
|
20
|
+
F && (b?.(P), j || N(""));
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
22
|
+
function R(e) {
|
|
23
|
+
O?.(e), !e.defaultPrevented && (e.key !== "Enter" || e.shiftKey || e.nativeEvent.isComposing || (e.preventDefault(), L()));
|
|
24
24
|
}
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
className: e(
|
|
27
|
-
children: [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
25
|
+
return /* @__PURE__ */ h("div", {
|
|
26
|
+
className: e(c, T == null ? l.field : l.slot, D),
|
|
27
|
+
children: [
|
|
28
|
+
T == null ? null : /* @__PURE__ */ m("div", {
|
|
29
|
+
className: u,
|
|
30
|
+
children: T
|
|
31
|
+
}),
|
|
32
|
+
/* @__PURE__ */ m(n, {
|
|
33
|
+
...k,
|
|
34
|
+
ref: A,
|
|
35
|
+
inline: !0,
|
|
36
|
+
rows: 1,
|
|
37
|
+
resize: "none",
|
|
38
|
+
value: P,
|
|
39
|
+
placeholder: x,
|
|
40
|
+
"aria-label": S,
|
|
41
|
+
disabled: w,
|
|
42
|
+
className: i,
|
|
43
|
+
onChange: (e) => {
|
|
44
|
+
I(e.target.value);
|
|
45
|
+
},
|
|
46
|
+
onKeyDown: R
|
|
47
|
+
}),
|
|
48
|
+
E == null ? null : /* @__PURE__ */ m("div", {
|
|
49
|
+
className: r,
|
|
50
|
+
children: E
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ m(t, {
|
|
53
|
+
type: "button",
|
|
54
|
+
role: "primary",
|
|
55
|
+
size: "sm",
|
|
56
|
+
icon: /* @__PURE__ */ m(p, { strokeWidth: 2 }),
|
|
57
|
+
"aria-label": C,
|
|
58
|
+
title: C,
|
|
59
|
+
disabled: !F,
|
|
60
|
+
className: e(a, F ? s : o),
|
|
61
|
+
onClick: L
|
|
62
|
+
})
|
|
63
|
+
]
|
|
53
64
|
});
|
|
54
65
|
});
|
|
55
66
|
//#endregion
|
|
56
|
-
export {
|
|
67
|
+
export { v as PromptBar, g as promptBarPlaceholder };
|
|
@@ -5,6 +5,21 @@
|
|
|
5
5
|
* The shell owns the single focus ring (inset, so it does not stack a second edge).
|
|
6
6
|
*/
|
|
7
7
|
export declare const promptBarShellClasses: string;
|
|
8
|
+
/**
|
|
9
|
+
* Leading inset. The text starts 1.25rem in; with a `start` slot the slot takes the same
|
|
10
|
+
* 0.5rem inset as the send circle, and the field keeps 0.25rem more air than the shell gap.
|
|
11
|
+
*/
|
|
12
|
+
export declare const promptBarShellStartPadClasses: {
|
|
13
|
+
readonly field: "pl-5";
|
|
14
|
+
readonly slot: "pl-2";
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Leading slot — a brand mark or avatar at the send circle's size (2.25rem), pinned to the
|
|
18
|
+
* last line like the send control.
|
|
19
|
+
*/
|
|
20
|
+
export declare const promptBarStartSlotClasses = "mr-1 flex size-9 shrink-0 items-center justify-center";
|
|
21
|
+
/** Trailing slot — extra inset controls (for example a mic **IconButton** `sm`) before send. */
|
|
22
|
+
export declare const promptBarEndSlotClasses = "flex shrink-0 items-end gap-2";
|
|
8
23
|
/**
|
|
9
24
|
* Empty is one line — min height matches the send circle, with padding that centers that line.
|
|
10
25
|
* Grows with the text, stops at three lines (`max-h`), then scrolls.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promptBarStyles.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/PromptBar/promptBarStyles.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAGN,CAAC;AAE7B;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAEf,CAAC;AAEpB;;GAEG;AACH,eAAO,MAAM,oBAAoB,kFACgD,CAAC;AAElF,0DAA0D;AAC1D,eAAO,MAAM,yBAAyB,8DAA8D,CAAC;AAErG;;;GAGG;AACH,eAAO,MAAM,yBAAyB,qDAAqD,CAAC"}
|
|
1
|
+
{"version":3,"file":"promptBarStyles.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/PromptBar/promptBarStyles.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAGN,CAAC;AAE7B;;;GAGG;AACH,eAAO,MAAM,6BAA6B;;;CAGhC,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,yBAAyB,0DAA0D,CAAC;AAEjG,gGAAgG;AAChG,eAAO,MAAM,uBAAuB,kCAAkC,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAEf,CAAC;AAEpB;;GAEG;AACH,eAAO,MAAM,oBAAoB,kFACgD,CAAC;AAElF,0DAA0D;AAC1D,eAAO,MAAM,yBAAyB,8DAA8D,CAAC;AAErG;;;GAGG;AACH,eAAO,MAAM,yBAAyB,qDAAqD,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { focusRingTransitionClasses as e } from "../../../lib/motion.js";
|
|
3
3
|
//#region src/components/molecules/PromptBar/promptBarStyles.ts
|
|
4
|
-
var t = "flex w-full items-end gap-2 rounded-[1.625rem] border border-border-control bg-surface p-2
|
|
4
|
+
var t = "flex w-full items-end gap-2 rounded-[1.625rem] border border-border-control bg-surface p-2 focus-within:outline-none focus-within:ring-2 focus-within:ring-inset focus-within:ring-focus-ring " + e, n = {
|
|
5
|
+
field: "pl-5",
|
|
6
|
+
slot: "pl-2"
|
|
7
|
+
}, r = "mr-1 flex size-9 shrink-0 items-center justify-center", i = "flex shrink-0 items-end gap-2", a = "min-h-9 min-w-0 flex-1 overflow-y-auto py-2 type-body [field-sizing:content] max-h-[4.75rem]", o = "focus-visible:!ring-0 focus-visible:!ring-offset-0 focus-visible:!shadow-none", s = "!bg-brand !text-on-brand hover:!bg-brand active:!bg-brand", c = "!bg-neutral !text-disabled disabled:!opacity-100";
|
|
5
8
|
//#endregion
|
|
6
|
-
export {
|
|
9
|
+
export { i as promptBarEndSlotClasses, a as promptBarFieldClasses, o as promptBarSendClasses, c as promptBarSendMutedClasses, s as promptBarSendReadyClasses, t as promptBarShellClasses, n as promptBarShellStartPadClasses, r as promptBarStartSlotClasses };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
2
|
+
import { type ChatDockPlacement } from "./chatDockStyles";
|
|
3
|
+
export { chatDockPlacements, type ChatDockPlacement } from "./chatDockStyles";
|
|
4
|
+
/** Layout-only — margin and placement. Not for colors or type. */
|
|
5
|
+
export type ChatDockLayoutClassName = string;
|
|
6
|
+
export interface ChatDockSuggestion {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
/** Leading Lucide icon element, for example `<DollarSign />`. */
|
|
10
|
+
icon?: ReactElement;
|
|
11
|
+
/**
|
|
12
|
+
* Sent as the visitor's message when chosen. Suggestions with a prompt also show as pills
|
|
13
|
+
* above the resting composer. Omit it for an action such as **Get started** — then only
|
|
14
|
+
* `onSuggestionSelect` runs.
|
|
15
|
+
*/
|
|
16
|
+
prompt?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ChatDockMessage {
|
|
19
|
+
id: string;
|
|
20
|
+
role: "user" | "assistant";
|
|
21
|
+
/** Text, or Markdown the app has already rendered. ChatDock does not parse Markdown. */
|
|
22
|
+
content: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
export interface ChatDockLabels {
|
|
25
|
+
/** Close control. Default: "Close chat". */
|
|
26
|
+
close: string;
|
|
27
|
+
/** Shown while `thinking`. Default: "Thinking…". */
|
|
28
|
+
thinking: string;
|
|
29
|
+
/** Accessible name for the message list. Default: "Conversation". */
|
|
30
|
+
conversation: string;
|
|
31
|
+
/** Accessible name for the suggestion groups. Default: "Suggested questions". */
|
|
32
|
+
suggestions: string;
|
|
33
|
+
/** Accessible name for the field. Default: "Ask anything". */
|
|
34
|
+
field: string;
|
|
35
|
+
/** Send control. Default: "Send". */
|
|
36
|
+
send: string;
|
|
37
|
+
}
|
|
38
|
+
export declare const chatDockDefaultLabels: ChatDockLabels;
|
|
39
|
+
export interface ChatDockProps {
|
|
40
|
+
/** Window title — usually the product or brand name. */
|
|
41
|
+
title: string;
|
|
42
|
+
/** Line under the title. */
|
|
43
|
+
subtitle?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Brand mark — **Avatar** `size="md"` (2.25rem). Shown at the start of the composer and in
|
|
46
|
+
* the window header.
|
|
47
|
+
*/
|
|
48
|
+
mark?: ReactNode;
|
|
49
|
+
/** First assistant message, always at the top of the window. */
|
|
50
|
+
greeting?: ReactNode;
|
|
51
|
+
/** The conversation, oldest first. The app owns it and appends replies as they stream. */
|
|
52
|
+
messages?: ChatDockMessage[];
|
|
53
|
+
/** Shows the thinking row after the last message while a reply is on its way. */
|
|
54
|
+
thinking?: boolean;
|
|
55
|
+
/** Pills above the resting composer (those with a `prompt`) and rows in the window. */
|
|
56
|
+
suggestions?: ChatDockSuggestion[];
|
|
57
|
+
/** Receives the visitor's message — typed, or a suggestion's `prompt`. */
|
|
58
|
+
onSend: (prompt: string) => void;
|
|
59
|
+
/** Every suggestion choice, including actions without a `prompt`. */
|
|
60
|
+
onSuggestionSelect?: (suggestion: ChatDockSuggestion) => void;
|
|
61
|
+
/** Controlled open state. */
|
|
62
|
+
open?: boolean;
|
|
63
|
+
defaultOpen?: boolean;
|
|
64
|
+
onOpenChange?: (open: boolean) => void;
|
|
65
|
+
/** Field placeholder. Default: "Ask anything…". */
|
|
66
|
+
placeholder?: string;
|
|
67
|
+
/** One line under the window's composer — for example what the assistant can't do. */
|
|
68
|
+
disclaimer?: ReactNode;
|
|
69
|
+
labels?: Partial<ChatDockLabels>;
|
|
70
|
+
/** `fixed` (default) pins the dock to the viewport; `inline` keeps it in flow for specimens. */
|
|
71
|
+
placement?: ChatDockPlacement;
|
|
72
|
+
className?: ChatDockLayoutClassName;
|
|
73
|
+
}
|
|
74
|
+
/** Pills above the resting composer: suggestions that send a prompt. */
|
|
75
|
+
export declare function chatDockPillSuggestions(suggestions: readonly ChatDockSuggestion[]): ChatDockSuggestion[];
|
|
76
|
+
/** Suggestion rows show until the conversation starts. */
|
|
77
|
+
export declare function chatDockShowsSuggestionRows(suggestions: readonly ChatDockSuggestion[], messages: readonly ChatDockMessage[]): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Window reveal. Closed, the clip is the resting composer's strip at the bottom of the window
|
|
80
|
+
* (full width, 3.25rem tall, pill radius); open, it is the whole card at the shell radius. Both
|
|
81
|
+
* strings share one shape so Motion can interpolate them. The clip is cleared once open so the
|
|
82
|
+
* card's shadow is not cut off.
|
|
83
|
+
*/
|
|
84
|
+
export declare const chatDockClosedClip = "inset(calc(100% - 3.25rem) 0rem 0rem 0rem round 1.625rem)";
|
|
85
|
+
export declare const chatDockOpenClip = "inset(calc(0% - 0rem) 0rem 0rem 0rem round 1rem)";
|
|
86
|
+
/**
|
|
87
|
+
* Pinned prompt that opens into a chat window. At rest it is a **PromptBar** with the brand
|
|
88
|
+
* mark; hovering shows suggestion pills above it. Focusing or typing opens a non-modal window
|
|
89
|
+
* in its place — header, conversation, suggestion rows, composer, and an optional disclaimer.
|
|
90
|
+
* Escape or Close returns to the resting bar. The page behind stays usable.
|
|
91
|
+
*/
|
|
92
|
+
export declare function ChatDock({ title, subtitle, mark, greeting, messages, thinking, suggestions, onSend, onSuggestionSelect, open: openProp, defaultOpen, onOpenChange, placeholder, disclaimer, labels: labelsProp, placement, className, }: ChatDockProps): import("react").JSX.Element;
|
|
93
|
+
//# sourceMappingURL=ChatDock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatDock.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/ChatDock/ChatDock.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AASf,OAAO,EAgBL,KAAK,iBAAiB,EACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE9E,kEAAkE;AAClE,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAE7C,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,wFAAwF;IACxF,OAAO,EAAE,SAAS,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,YAAY,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,WAAW,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,qBAAqB,EAAE,cAOnC,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;IAC7B,iFAAiF;IACjF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uFAAuF;IACvF,WAAW,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACnC,0EAA0E;IAC1E,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,qEAAqE;IACrE,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC9D,6BAA6B;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sFAAsF;IACtF,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACjC,gGAAgG;IAChG,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,SAAS,CAAC,EAAE,uBAAuB,CAAC;CACrC;AAED,wEAAwE;AACxE,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,SAAS,kBAAkB,EAAE,GAAG,kBAAkB,EAAE,CAExG;AAED,0DAA0D;AAC1D,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,SAAS,kBAAkB,EAAE,EAC1C,QAAQ,EAAE,SAAS,eAAe,EAAE,GACnC,OAAO,CAET;AAKD;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,8DAA8D,CAAC;AAC9F,eAAO,MAAM,gBAAgB,qDAAqD,CAAC;AAEnF;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,QAAa,EACb,QAAgB,EAChB,WAAgB,EAChB,MAAM,EACN,kBAAkB,EAClB,IAAI,EAAE,QAAQ,EACd,WAAmB,EACnB,YAAY,EACZ,WAAW,EACX,UAAU,EACV,MAAM,EAAE,UAAU,EAClB,SAAmB,EACnB,SAAS,GACV,EAAE,aAAa,+BA0Qf"}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../../lib/cn.js";
|
|
3
|
+
import { motionBeatSeconds as t, motionTransitionProp as n, readMotionDurationSeconds as ee } from "../../../lib/motion.js";
|
|
4
|
+
import { ButtonIcon as r } from "../../atoms/Button/ButtonIcon.js";
|
|
5
|
+
import { Button as i } from "../../atoms/Button/Button.js";
|
|
6
|
+
import { Status as te } from "../../atoms/Status/Status.js";
|
|
7
|
+
import { PromptBar as a } from "../../molecules/PromptBar/PromptBar.js";
|
|
8
|
+
import { OverlayPanelHeader as ne } from "../Dialog/OverlayPanelHeader.js";
|
|
9
|
+
import { chatDockAssistantMessageClasses as o, chatDockComposerClasses as re, chatDockDisclaimerClasses as ie, chatDockDockClasses as ae, chatDockGridClasses as oe, chatDockPillClasses as se, chatDockPillsClasses as ce, chatDockPlacements as s, chatDockRootClasses as le, chatDockSuggestionLabelClasses as ue, chatDockSuggestionListClasses as de, chatDockSuggestionRowContentClasses as fe, chatDockThinkingClasses as pe, chatDockThreadClasses as me, chatDockUserMessageClasses as he, chatDockWindowClasses as ge } from "./chatDockStyles.js";
|
|
10
|
+
import { useEffect as _e, useId as c, useLayoutEffect as ve, useRef as l, useState as u } from "react";
|
|
11
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
12
|
+
import { AnimatePresence as p, motion as m, useReducedMotion as ye } from "motion/react";
|
|
13
|
+
//#region src/components/organisms/ChatDock/ChatDock.tsx
|
|
14
|
+
var h = {
|
|
15
|
+
close: "Close chat",
|
|
16
|
+
thinking: "Thinking…",
|
|
17
|
+
conversation: "Conversation",
|
|
18
|
+
suggestions: "Suggested questions",
|
|
19
|
+
field: "Ask anything",
|
|
20
|
+
send: "Send"
|
|
21
|
+
};
|
|
22
|
+
function g(e) {
|
|
23
|
+
return e.filter((e) => e.prompt != null && e.prompt.trim() !== "");
|
|
24
|
+
}
|
|
25
|
+
function _(e, t) {
|
|
26
|
+
return e.length > 0 && t.length === 0;
|
|
27
|
+
}
|
|
28
|
+
var v = 48, y = "inset(calc(100% - 3.25rem) 0rem 0rem 0rem round 1.625rem)", b = "inset(calc(0% - 0rem) 0rem 0rem 0rem round 1rem)";
|
|
29
|
+
function x({ title: s, subtitle: x, mark: S, greeting: C, messages: w = [], thinking: be = !1, suggestions: T = [], onSend: xe, onSuggestionSelect: Se, open: E, defaultOpen: D = !1, onOpenChange: Ce, placeholder: O, disclaimer: k, labels: A, placement: j = "fixed", className: we }) {
|
|
30
|
+
let M = {
|
|
31
|
+
...h,
|
|
32
|
+
...A
|
|
33
|
+
}, N = c(), P = c(), F = ye(), I = E !== void 0, [Te, Ee] = u(D), L = I ? E : Te, [R, z] = u(""), B = l(null), V = l(null), H = l(null), U = l(!0), W = l(!1), G = l(L), K = l(L);
|
|
34
|
+
function q(e) {
|
|
35
|
+
e !== L && (I || Ee(e), Ce?.(e));
|
|
36
|
+
}
|
|
37
|
+
function J(e) {
|
|
38
|
+
let t = e.trim();
|
|
39
|
+
t !== "" && (q(!0), U.current = !0, z(""), xe(t));
|
|
40
|
+
}
|
|
41
|
+
function Y(e) {
|
|
42
|
+
Se?.(e), e.prompt != null && J(e.prompt);
|
|
43
|
+
}
|
|
44
|
+
_e(() => {
|
|
45
|
+
L && !G.current ? V.current?.focus() : !L && G.current && (K.current = !1, W.current = !0, B.current?.focus(), W.current = !1), G.current = L;
|
|
46
|
+
}, [L]), ve(() => {
|
|
47
|
+
let e = H.current;
|
|
48
|
+
e != null && U.current && (e.scrollTop = e.scrollHeight);
|
|
49
|
+
});
|
|
50
|
+
function De(e) {
|
|
51
|
+
e.key !== "Escape" || e.defaultPrevented || (e.preventDefault(), q(!1));
|
|
52
|
+
}
|
|
53
|
+
let X = g(T), Oe = _(T, w), ke = n("medium"), Z = n("fast"), Q = F ? {
|
|
54
|
+
initial: { opacity: 0 },
|
|
55
|
+
animate: { opacity: 1 },
|
|
56
|
+
exit: { opacity: 0 }
|
|
57
|
+
} : {
|
|
58
|
+
initial: {
|
|
59
|
+
clipPath: y,
|
|
60
|
+
opacity: .6
|
|
61
|
+
},
|
|
62
|
+
animate: {
|
|
63
|
+
clipPath: b,
|
|
64
|
+
opacity: 1,
|
|
65
|
+
transitionEnd: { clipPath: "none" }
|
|
66
|
+
},
|
|
67
|
+
exit: {
|
|
68
|
+
clipPath: [b, y],
|
|
69
|
+
opacity: [1, .6]
|
|
70
|
+
}
|
|
71
|
+
}, $ = F || K.current ? {} : {
|
|
72
|
+
initial: {
|
|
73
|
+
opacity: 0,
|
|
74
|
+
y: 8
|
|
75
|
+
},
|
|
76
|
+
animate: {
|
|
77
|
+
opacity: 1,
|
|
78
|
+
y: 0
|
|
79
|
+
},
|
|
80
|
+
transition: {
|
|
81
|
+
...Z,
|
|
82
|
+
delay: t(1)
|
|
83
|
+
}
|
|
84
|
+
}, Ae = F ? 0 : ee("medium") * .6;
|
|
85
|
+
return /* @__PURE__ */ d("div", {
|
|
86
|
+
className: e(le[j], we),
|
|
87
|
+
"data-open": L ? "" : void 0,
|
|
88
|
+
children: /* @__PURE__ */ d("div", {
|
|
89
|
+
className: oe,
|
|
90
|
+
children: /* @__PURE__ */ d("div", {
|
|
91
|
+
className: "band",
|
|
92
|
+
children: /* @__PURE__ */ d(p, {
|
|
93
|
+
initial: !1,
|
|
94
|
+
mode: "popLayout",
|
|
95
|
+
children: L ? /* @__PURE__ */ f(m.section, {
|
|
96
|
+
role: "dialog",
|
|
97
|
+
"aria-modal": "false",
|
|
98
|
+
"aria-labelledby": N,
|
|
99
|
+
"aria-describedby": x == null ? void 0 : P,
|
|
100
|
+
className: ge[j],
|
|
101
|
+
initial: Q.initial,
|
|
102
|
+
animate: Q.animate,
|
|
103
|
+
exit: Q.exit,
|
|
104
|
+
transition: ke,
|
|
105
|
+
onKeyDown: De,
|
|
106
|
+
children: [
|
|
107
|
+
/* @__PURE__ */ d(ne, {
|
|
108
|
+
titleId: N,
|
|
109
|
+
descriptionId: P,
|
|
110
|
+
title: s,
|
|
111
|
+
description: x,
|
|
112
|
+
headerStart: S,
|
|
113
|
+
closeLabel: M.close,
|
|
114
|
+
onClose: () => q(!1),
|
|
115
|
+
delineated: !0
|
|
116
|
+
}),
|
|
117
|
+
/* @__PURE__ */ f("div", {
|
|
118
|
+
ref: H,
|
|
119
|
+
className: me,
|
|
120
|
+
role: "log",
|
|
121
|
+
"aria-label": M.conversation,
|
|
122
|
+
onScroll: (e) => {
|
|
123
|
+
let t = e.currentTarget;
|
|
124
|
+
U.current = t.scrollHeight - t.scrollTop - t.clientHeight <= v;
|
|
125
|
+
},
|
|
126
|
+
children: [C == null ? null : /* @__PURE__ */ d(m.div, {
|
|
127
|
+
className: o,
|
|
128
|
+
...$,
|
|
129
|
+
children: C
|
|
130
|
+
}), /* @__PURE__ */ f(p, {
|
|
131
|
+
initial: !1,
|
|
132
|
+
children: [w.map((e) => /* @__PURE__ */ d(m.div, {
|
|
133
|
+
"data-role": e.role,
|
|
134
|
+
className: e.role === "user" ? he : o,
|
|
135
|
+
initial: !F && {
|
|
136
|
+
opacity: 0,
|
|
137
|
+
y: 8
|
|
138
|
+
},
|
|
139
|
+
animate: {
|
|
140
|
+
opacity: 1,
|
|
141
|
+
y: 0
|
|
142
|
+
},
|
|
143
|
+
transition: Z,
|
|
144
|
+
children: e.content
|
|
145
|
+
}, e.id)), be ? /* @__PURE__ */ f(m.div, {
|
|
146
|
+
className: pe,
|
|
147
|
+
initial: !F && { opacity: 0 },
|
|
148
|
+
animate: { opacity: 1 },
|
|
149
|
+
exit: {
|
|
150
|
+
opacity: 0,
|
|
151
|
+
transition: { duration: 0 }
|
|
152
|
+
},
|
|
153
|
+
transition: Z,
|
|
154
|
+
children: [/* @__PURE__ */ d(te, {
|
|
155
|
+
variant: "dot",
|
|
156
|
+
tone: "neutral",
|
|
157
|
+
pulsing: !0,
|
|
158
|
+
besideLabel: !0
|
|
159
|
+
}), /* @__PURE__ */ d("span", { children: M.thinking })]
|
|
160
|
+
}, "thinking") : null]
|
|
161
|
+
})]
|
|
162
|
+
}),
|
|
163
|
+
Oe ? /* @__PURE__ */ d(m.div, {
|
|
164
|
+
className: de,
|
|
165
|
+
role: "group",
|
|
166
|
+
"aria-label": M.suggestions,
|
|
167
|
+
...$,
|
|
168
|
+
children: T.map((e) => /* @__PURE__ */ d(i, {
|
|
169
|
+
type: "button",
|
|
170
|
+
role: "ghost",
|
|
171
|
+
layout: "row",
|
|
172
|
+
onClick: () => Y(e),
|
|
173
|
+
children: /* @__PURE__ */ f("span", {
|
|
174
|
+
className: fe,
|
|
175
|
+
children: [e.icon == null ? null : /* @__PURE__ */ d(r, {
|
|
176
|
+
size: "md",
|
|
177
|
+
children: e.icon
|
|
178
|
+
}), /* @__PURE__ */ d("span", {
|
|
179
|
+
className: ue,
|
|
180
|
+
children: e.label
|
|
181
|
+
})]
|
|
182
|
+
})
|
|
183
|
+
}, e.id))
|
|
184
|
+
}) : null,
|
|
185
|
+
/* @__PURE__ */ d("div", {
|
|
186
|
+
className: re,
|
|
187
|
+
children: /* @__PURE__ */ d(a, {
|
|
188
|
+
ref: V,
|
|
189
|
+
value: R,
|
|
190
|
+
onValueChange: z,
|
|
191
|
+
onSend: J,
|
|
192
|
+
placeholder: O,
|
|
193
|
+
"aria-label": M.field,
|
|
194
|
+
sendLabel: M.send
|
|
195
|
+
})
|
|
196
|
+
}),
|
|
197
|
+
k == null ? null : /* @__PURE__ */ d("p", {
|
|
198
|
+
className: ie,
|
|
199
|
+
children: k
|
|
200
|
+
})
|
|
201
|
+
]
|
|
202
|
+
}, "window") : /* @__PURE__ */ f(m.div, {
|
|
203
|
+
className: ae,
|
|
204
|
+
initial: { opacity: 0 },
|
|
205
|
+
animate: {
|
|
206
|
+
opacity: 1,
|
|
207
|
+
transition: {
|
|
208
|
+
...Z,
|
|
209
|
+
delay: Ae
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
exit: {
|
|
213
|
+
opacity: 0,
|
|
214
|
+
transition: { duration: 0 }
|
|
215
|
+
},
|
|
216
|
+
children: [X.length > 0 ? /* @__PURE__ */ d("div", {
|
|
217
|
+
className: ce,
|
|
218
|
+
role: "group",
|
|
219
|
+
"aria-label": M.suggestions,
|
|
220
|
+
children: X.map((e, t) => /* @__PURE__ */ d("span", {
|
|
221
|
+
className: se,
|
|
222
|
+
style: { "--chat-dock-pill-index": t },
|
|
223
|
+
children: /* @__PURE__ */ d(i, {
|
|
224
|
+
type: "button",
|
|
225
|
+
role: "secondary",
|
|
226
|
+
size: "md",
|
|
227
|
+
icon: e.icon,
|
|
228
|
+
onClick: () => Y(e),
|
|
229
|
+
children: e.label
|
|
230
|
+
})
|
|
231
|
+
}, e.id))
|
|
232
|
+
}) : null, /* @__PURE__ */ d(a, {
|
|
233
|
+
ref: B,
|
|
234
|
+
value: R,
|
|
235
|
+
onValueChange: (e) => {
|
|
236
|
+
z(e), q(!0);
|
|
237
|
+
},
|
|
238
|
+
onSend: J,
|
|
239
|
+
onFocus: () => {
|
|
240
|
+
W.current || q(!0);
|
|
241
|
+
},
|
|
242
|
+
onClick: () => q(!0),
|
|
243
|
+
start: S,
|
|
244
|
+
placeholder: O,
|
|
245
|
+
"aria-label": M.field,
|
|
246
|
+
sendLabel: M.send
|
|
247
|
+
})]
|
|
248
|
+
}, "rest")
|
|
249
|
+
})
|
|
250
|
+
})
|
|
251
|
+
})
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
//#endregion
|
|
255
|
+
export { x as ChatDock, y as chatDockClosedClip, h as chatDockDefaultLabels, b as chatDockOpenClip, g as chatDockPillSuggestions, s as chatDockPlacements, _ as chatDockShowsSuggestionRows };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare const chatDockPlacements: readonly ["fixed", "inline"];
|
|
2
|
+
/**
|
|
3
|
+
* `fixed` — page chrome, pinned to the bottom of the viewport on the page grid.
|
|
4
|
+
* `inline` — specimen in normal flow (Storybook docs, previews).
|
|
5
|
+
*/
|
|
6
|
+
export type ChatDockPlacement = (typeof chatDockPlacements)[number];
|
|
7
|
+
/**
|
|
8
|
+
* Pinned root. The wrapper ignores pointer events so the page under its edges stays
|
|
9
|
+
* clickable; only the dock takes input. Sits under **SiteNav** (`z-50`).
|
|
10
|
+
*/
|
|
11
|
+
export declare const chatDockRootClasses: Record<ChatDockPlacement, string>;
|
|
12
|
+
/** The dock's column — the page grid narrowed to the composer width. */
|
|
13
|
+
export declare const chatDockGridClasses = "grid-page [--grid-max:40rem]";
|
|
14
|
+
/** Hover group: the composer plus the suggestion pills above it. */
|
|
15
|
+
export declare const chatDockDockClasses = "group pointer-events-auto relative col-span-full";
|
|
16
|
+
/**
|
|
17
|
+
* Suggestion pills above the resting composer. Hidden until the dock is hovered; Tailwind's
|
|
18
|
+
* `hover` variants only apply on hover-capable pointers, so touch never shows them (the open
|
|
19
|
+
* window lists the same suggestions). Bottom padding, not margin, keeps the gap inside the hover
|
|
20
|
+
* area so the pointer can travel from the bar to a pill.
|
|
21
|
+
*/
|
|
22
|
+
export declare const chatDockPillsClasses: string;
|
|
23
|
+
/**
|
|
24
|
+
* One pill. Each rises in one `--motion-stagger` after the one before it (index from
|
|
25
|
+
* `--chat-dock-pill-index`); all leave together.
|
|
26
|
+
*/
|
|
27
|
+
export declare const chatDockPillClasses: string;
|
|
28
|
+
/**
|
|
29
|
+
* Chat window — the Card layout shell on the elevated surface. Phones get the whole viewport
|
|
30
|
+
* (above **SiteNav**); from `md` it sits where the composer was, at a fixed height so arriving
|
|
31
|
+
* messages scroll inside instead of growing the window.
|
|
32
|
+
*/
|
|
33
|
+
export declare const chatDockWindowClasses: Record<ChatDockPlacement, string>;
|
|
34
|
+
/** Scrolling conversation — greeting, turns, and the thinking row. */
|
|
35
|
+
export declare const chatDockThreadClasses: string;
|
|
36
|
+
/** Assistant text — the greeting and replies. */
|
|
37
|
+
export declare const chatDockAssistantMessageClasses: string;
|
|
38
|
+
/** Visitor turn — right-aligned on the muted fill, at the card body radius. */
|
|
39
|
+
export declare const chatDockUserMessageClasses: string;
|
|
40
|
+
export declare const chatDockThinkingClasses: string;
|
|
41
|
+
/** Suggestion rows in the window — above the composer, under a hairline. */
|
|
42
|
+
export declare const chatDockSuggestionListClasses: string;
|
|
43
|
+
/** Icon + label inside a **Button** `layout="row"` suggestion. */
|
|
44
|
+
export declare const chatDockSuggestionRowContentClasses: string;
|
|
45
|
+
export declare const chatDockSuggestionLabelClasses = "min-w-0 truncate";
|
|
46
|
+
export declare const chatDockComposerClasses: string;
|
|
47
|
+
export declare const chatDockDisclaimerClasses: string;
|
|
48
|
+
//# sourceMappingURL=chatDockStyles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chatDockStyles.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/ChatDock/chatDockStyles.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,kBAAkB,8BAA+B,CAAC;AAE/D;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAGjE,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,mBAAmB,iCAAiC,CAAC;AAElE,oEAAoE;AACpE,eAAO,MAAM,mBAAmB,qDAAqD,CAAC;AAEtF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,QAIhC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,QAO/B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAkBnE,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,qBAAqB,QAGjC,CAAC;AAEF,iDAAiD;AACjD,eAAO,MAAM,+BAA+B,QAAyC,CAAC;AAEtF,+EAA+E;AAC/E,eAAO,MAAM,0BAA0B,QAGtC,CAAC;AAEF,eAAO,MAAM,uBAAuB,QAGnC,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,6BAA6B,QAGzC,CAAC;AAEF,kEAAkE;AAClE,eAAO,MAAM,mCAAmC,QAG/C,CAAC;AAEF,eAAO,MAAM,8BAA8B,qBAAqB,CAAC;AAEjE,eAAO,MAAM,uBAAuB,QAAiD,CAAC;AAEtF,eAAO,MAAM,yBAAyB,QAIrC,CAAC"}
|