rift-ds 1.22.0 → 1.23.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 +3 -3
- package/behaviors/chat-card.css +135 -0
- package/chat/AssistantTurn.js +9 -3
- package/chat/ChatLauncher.js +3 -5
- package/chat/ChatProvider.d.ts +10 -1
- package/chat/ChatProvider.js +3 -2
- package/chat/ChatWidget.css +12 -0
- package/chat/ChatWidget.d.ts +27 -4
- package/chat/ChatWidget.js +73 -37
- package/chat/DemoWelcome.js +2 -2
- package/chat/actions.d.ts +105 -0
- package/chat/actions.js +47 -0
- package/chat/demo-card-components.d.ts +3 -4
- package/chat/demo-script.js +15 -15
- package/chat/generatedStarters.d.ts +19 -0
- package/chat/generatedStarters.js +49 -0
- package/chat/index.d.ts +7 -3
- package/chat/index.js +25 -2
- package/chat/placement.d.ts +9 -0
- package/chat/placement.js +7 -0
- package/chat/queries.d.ts +6 -0
- package/chat/queries.js +25 -0
- package/chat/questions.d.ts +1 -1
- package/chat/questions.js +1 -1
- package/chat/registry.json.d.ts +4 -2
- package/chat/registry.json.js +1 -1
- package/chat/selection.css +8 -0
- package/chat/selection.d.ts +40 -0
- package/chat/selection.js +140 -0
- package/chat/selectionContext.d.ts +70 -0
- package/chat/selectionContext.js +60 -0
- package/chat/server.d.ts +54 -1
- package/chat/server.js +101 -5
- package/chat/suggestions.d.ts +12 -8
- package/chat/suggestions.js +1 -1
- package/chat/types.d.ts +2 -0
- package/chat/useChat.js +5 -3
- package/components/ActionCard/ActionCard.css +147 -0
- package/components/ActionCard/ActionCard.d.ts +54 -0
- package/components/ActionCard/ActionCard.js +75 -0
- package/components/ActionReadout/ActionReadout.css +47 -0
- package/components/ActionReadout/ActionReadout.d.ts +29 -0
- package/components/ActionReadout/ActionReadout.js +22 -0
- package/components/AgentPlan/AgentPlan.css +18 -8
- package/components/AgentPlan/AgentPlan.js +1 -0
- package/components/AppSidebar/AppSidebar.css +11 -5
- package/components/AppSidebar/AppSidebar.d.ts +2 -0
- package/components/AppSidebar/AppSidebar.js +13 -1
- package/components/ArtifactCard/ArtifactCard.css +11 -10
- package/components/ArtifactCard/ArtifactCard.js +3 -1
- package/components/ChatThread/ChatThread.css +6 -3
- package/components/Chip/Chip.css +9 -1
- package/components/CodeBlock/CodeBlock.css +2 -0
- package/components/CodeDiff/CodeDiff.css +18 -8
- package/components/CodeDiff/CodeDiff.js +1 -0
- package/components/Composer/Composer.css +52 -13
- package/components/Composer/Composer.d.ts +9 -1
- package/components/Composer/Composer.js +19 -1
- package/components/DataTable/FilterEditor.js +4 -2
- package/components/DataTable/filterModel.d.ts +8 -0
- package/components/DataTable/filterModel.js +4 -0
- package/components/DataTable/views.js +2 -2
- package/components/DocumentChip/DocumentChip.css +27 -3
- package/components/EntitySwitcher/EntitySwitcher.css +333 -0
- package/components/EntitySwitcher/EntitySwitcher.d.ts +74 -0
- package/components/EntitySwitcher/EntitySwitcher.js +291 -0
- package/components/InterruptCard/InterruptCard.css +96 -34
- package/components/InterruptCard/InterruptCard.d.ts +20 -3
- package/components/InterruptCard/InterruptCard.js +23 -8
- package/components/MessageCard/MessageCard.css +27 -18
- package/components/MessageCard/MessageCard.js +1 -0
- package/components/PromptSuggestions/PromptSuggestions.css +3 -0
- package/components/Prose/Prose.css +2 -0
- package/components/QuestionCard/QuestionCard.css +9 -5
- package/components/QuestionCard/QuestionCard.js +1 -0
- package/components/SourceTrail/SourceTrail.css +33 -11
- package/components/SourceTrail/SourceTrail.js +3 -2
- package/components/TableToolbar/TableToolbar.css +4 -1
- package/components/TableToolbar/TableToolbar.js +1 -1
- package/components/ToolCall/ToolCall.css +89 -22
- package/components/ToolCall/ToolCall.js +2 -1
- package/components/UsageCard/UsageCard.css +29 -2
- package/components/UsageCard/UsageCard.js +1 -0
- package/components/registry.json +24 -0
- package/components/registry.json.d.ts +24 -0
- package/components/registry.json.js +1 -1
- package/fonts/presets/bricolage-grotesque-300-800-latin-ext.woff2 +0 -0
- package/fonts/presets/bricolage-grotesque-300-800-latin.woff2 +0 -0
- package/fonts/presets/figtree-300-800-latin-ext.woff2 +0 -0
- package/fonts/presets/figtree-300-800-latin.woff2 +0 -0
- package/index.d.ts +3 -0
- package/index.js +6 -0
- package/package.json +5 -1
- package/tokens/motion.d.ts +2 -0
- package/tokens/motion.js +2 -0
- package/tokens/presets/plum.css +419 -0
- package/tokens/presets/presets.css +1 -0
- package/tokens/registry.json +2 -0
- package/tokens/registry.json.d.ts +2 -0
- package/tokens/registry.json.js +1 -1
- package/tokens/tokens-dark.css +4 -0
- package/tokens/tokens-light.css +4 -0
- package/tokens/tokens-typography.css +8 -2
- package/tokens/values.json.js +1 -1
package/chat/useChat.js
CHANGED
|
@@ -100,6 +100,7 @@ function useChat(transport, placeholders = DEFAULT_PLACEHOLDER_COPY) {
|
|
|
100
100
|
text: ""
|
|
101
101
|
};
|
|
102
102
|
setLive(current);
|
|
103
|
+
let spoken = "";
|
|
103
104
|
const update = (next) => {
|
|
104
105
|
current = next;
|
|
105
106
|
setLive(next);
|
|
@@ -151,6 +152,7 @@ function useChat(transport, placeholders = DEFAULT_PLACEHOLDER_COPY) {
|
|
|
151
152
|
// Thinking ends at the first delta; freeze the duration then.
|
|
152
153
|
durationSeconds: current.durationSeconds ?? Math.max(1, Math.round((Date.now() - startedAt) / 1e3))
|
|
153
154
|
};
|
|
155
|
+
spoken += event.text;
|
|
154
156
|
reveal.append(event.text);
|
|
155
157
|
break;
|
|
156
158
|
/* A guardrail line and a failure are not the model speaking, so
|
|
@@ -180,7 +182,7 @@ function useChat(transport, placeholders = DEFAULT_PLACEHOLDER_COPY) {
|
|
|
180
182
|
const stopped = controller.signal.aborted;
|
|
181
183
|
if (stopped) current = { ...current, outcome: "stopped" };
|
|
182
184
|
if (current.text !== "") {
|
|
183
|
-
commit(current, startedAt,
|
|
185
|
+
commit(current, startedAt, spoken);
|
|
184
186
|
} else if (current.content || current.cards?.length || current.question) {
|
|
185
187
|
commit(current, startedAt, null);
|
|
186
188
|
} else if (stopped) {
|
|
@@ -196,14 +198,14 @@ function useChat(transport, placeholders = DEFAULT_PLACEHOLDER_COPY) {
|
|
|
196
198
|
if (current.text === "") {
|
|
197
199
|
commit({ ...current, text: placeholders.stopped }, startedAt, null);
|
|
198
200
|
} else {
|
|
199
|
-
commit(current, startedAt,
|
|
201
|
+
commit(current, startedAt, spoken);
|
|
200
202
|
}
|
|
201
203
|
} else {
|
|
202
204
|
current = { ...current, outcome: "failed" };
|
|
203
205
|
if (current.text === "") {
|
|
204
206
|
commit({ ...current, text: placeholders.failed }, startedAt, null);
|
|
205
207
|
} else {
|
|
206
|
-
commit(current, startedAt,
|
|
208
|
+
commit(current, startedAt, spoken);
|
|
207
209
|
}
|
|
208
210
|
console.error(err);
|
|
209
211
|
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
ACTION CARD COMPONENT
|
|
3
|
+
A change an assistant proposes and the reader
|
|
4
|
+
confirms: the title and what it leaves alone
|
|
5
|
+
over Confirm and Dismiss, then one row that
|
|
6
|
+
records what happened, with Undo.
|
|
7
|
+
|
|
8
|
+
A content card of the chat furniture: the
|
|
9
|
+
container fill behind its border, at the
|
|
10
|
+
ArtifactCard's radius, with a bubble's
|
|
11
|
+
padding so its text starts where the
|
|
12
|
+
reply's own text does.
|
|
13
|
+
============================================ */
|
|
14
|
+
|
|
15
|
+
.ds-action-card {
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
align-items: flex-start;
|
|
20
|
+
/* The detail is the title's subline, set straight under it; the buttons
|
|
21
|
+
stand a block's seam off them. */
|
|
22
|
+
gap: var(--ds-chat-card-gap-subline);
|
|
23
|
+
width: 100%;
|
|
24
|
+
min-width: 0;
|
|
25
|
+
padding: var(--ds-chat-card-edge) var(--ds-chat-card-inset);
|
|
26
|
+
border: var(--ds-chat-card-border);
|
|
27
|
+
border-radius: var(--ds-chat-card-radius);
|
|
28
|
+
background-color: var(--ds-chat-card-bg);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* The record is one row: what happened, and Undo at its end. */
|
|
32
|
+
.ds-action-card--confirmed,
|
|
33
|
+
.ds-action-card--dismissed,
|
|
34
|
+
.ds-action-card--undone {
|
|
35
|
+
flex-direction: row;
|
|
36
|
+
flex-wrap: wrap;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: space-between;
|
|
39
|
+
gap: var(--gap-200);
|
|
40
|
+
/* One row, at the chat cards' one-row height (see ToolCall's header):
|
|
41
|
+
with Undo or without, a record is as tall as a closed ToolCall. */
|
|
42
|
+
min-height: calc(var(--ds-chat-card-row-height) + 2 * var(--border-025));
|
|
43
|
+
padding: var(--ds-chat-card-row-pad) var(--ds-chat-card-inset);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ds-action-card__title,
|
|
47
|
+
.ds-action-card__record {
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
gap: var(--gap-200);
|
|
51
|
+
min-width: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Both span the card, so the trailing icon reaches its end. */
|
|
55
|
+
.ds-action-card__title {
|
|
56
|
+
align-self: stretch;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.ds-action-card__record {
|
|
60
|
+
flex: 1 1 auto;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.ds-action-card__title {
|
|
64
|
+
font-family: var(--font-title-body-family);
|
|
65
|
+
font-size: var(--font-title-body-size);
|
|
66
|
+
font-weight: var(--font-title-body-weight);
|
|
67
|
+
line-height: var(--font-title-body-line-height);
|
|
68
|
+
letter-spacing: var(--font-title-body-letter-spacing);
|
|
69
|
+
color: var(--color-text-primary);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.ds-action-card__detail {
|
|
73
|
+
font-family: var(--font-paragraph-sm-family);
|
|
74
|
+
font-size: var(--font-paragraph-sm-size);
|
|
75
|
+
font-weight: var(--font-paragraph-sm-weight);
|
|
76
|
+
line-height: var(--font-paragraph-sm-line-height);
|
|
77
|
+
letter-spacing: var(--font-paragraph-sm-letter-spacing);
|
|
78
|
+
color: var(--color-text-secondary);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* A one-row label, set like every disclosure header's. */
|
|
82
|
+
.ds-action-card__record {
|
|
83
|
+
font-family: var(--font-paragraph-sm-emphasis-family);
|
|
84
|
+
font-size: var(--font-paragraph-sm-emphasis-size);
|
|
85
|
+
font-weight: var(--font-paragraph-sm-emphasis-weight);
|
|
86
|
+
line-height: var(--font-paragraph-sm-emphasis-line-height);
|
|
87
|
+
letter-spacing: var(--font-paragraph-sm-emphasis-letter-spacing);
|
|
88
|
+
color: var(--color-text-primary);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.ds-action-card__record-text {
|
|
92
|
+
display: inline-flex;
|
|
93
|
+
flex-wrap: wrap;
|
|
94
|
+
gap: var(--gap-100);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.ds-action-card__record-note {
|
|
98
|
+
font-weight: var(--font-paragraph-sm-weight);
|
|
99
|
+
color: var(--color-text-tertiary);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.ds-action-card__icon {
|
|
103
|
+
display: inline-flex;
|
|
104
|
+
flex-shrink: 0;
|
|
105
|
+
/* A title's icon trails it, so the card's text starts on its inset edge. */
|
|
106
|
+
order: 1;
|
|
107
|
+
margin-inline-start: auto;
|
|
108
|
+
--icon-size: var(--icon-size-500);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* What the change will do, or did: the recipe's fact list, a text gap off
|
|
112
|
+
the title (and its detail) above it. */
|
|
113
|
+
.ds-action-card__facts {
|
|
114
|
+
align-self: stretch;
|
|
115
|
+
margin-block-start: var(--ds-chat-card-gap-text);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* A confirmed record that keeps its facts stays a card, not a row: the receipt
|
|
119
|
+
and Undo share the head, which holds a compact control's height so the
|
|
120
|
+
title does not move when Undo arrives. */
|
|
121
|
+
.ds-action-card--detailed {
|
|
122
|
+
flex-direction: column;
|
|
123
|
+
align-items: stretch;
|
|
124
|
+
gap: 0;
|
|
125
|
+
min-height: 0;
|
|
126
|
+
padding: var(--ds-chat-card-edge) var(--ds-chat-card-inset);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.ds-action-card__head {
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
justify-content: space-between;
|
|
133
|
+
gap: var(--gap-200);
|
|
134
|
+
min-width: 0;
|
|
135
|
+
min-height: var(--control-height-compact);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.ds-action-card__actions {
|
|
139
|
+
margin-block-start: var(--ds-chat-card-gap-block);
|
|
140
|
+
display: inline-flex;
|
|
141
|
+
flex-wrap: wrap;
|
|
142
|
+
gap: var(--gap-200);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.ds-action-card .material-symbols-rounded {
|
|
146
|
+
color: inherit;
|
|
147
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ActionReadoutFact } from '../ActionReadout/ActionReadout';
|
|
3
|
+
/** Where a proposed change stands. */
|
|
4
|
+
export type ActionCardStatus = 'proposed' | 'confirmed' | 'dismissed' | 'undone';
|
|
5
|
+
/** Props owned by ActionCard itself — everything else falls through to the root `<div>`. */
|
|
6
|
+
type ActionCardOwnProps = {
|
|
7
|
+
/** What the change is, with how much it touches: "Cancel orders: 69 orders". Collides with the native `title` tooltip attribute on purpose: the card shows it. */
|
|
8
|
+
title: React.ReactNode;
|
|
9
|
+
/** A quiet line under the title: what the change leaves alone, and why ("Left as they are: 2 already shipped"). */
|
|
10
|
+
detail?: React.ReactNode;
|
|
11
|
+
/** What the change will do, a line each, as ActionReadout lists what one did: shown over Confirm, then kept, under the receipt, by the confirmed record. A dismissed or undone card is one row and shows none. Write them for the state the card is in. */
|
|
12
|
+
facts?: ActionReadoutFact[];
|
|
13
|
+
/** The leading mark: a Material Symbol name, or your own element. */
|
|
14
|
+
icon?: string | React.ReactNode;
|
|
15
|
+
/** Where the change stands. Fully controlled by design: the host makes the change, so it owns whether it was made. `proposed` offers Confirm and Dismiss; the others are the card's record. Defaults to `proposed`. */
|
|
16
|
+
status?: ActionCardStatus;
|
|
17
|
+
/** What the confirmed card says was done: "69 orders cancelled". Defaults to the title. */
|
|
18
|
+
receipt?: React.ReactNode;
|
|
19
|
+
/** The colour of Confirm: `destructive` for a change that takes something away (a cancellation, a refund). Defaults to `default`. */
|
|
20
|
+
tone?: 'default' | 'destructive';
|
|
21
|
+
/** Called by Confirm. The host makes the change, then sets `status` to `confirmed`. */
|
|
22
|
+
onConfirm?: () => void;
|
|
23
|
+
/** Called by Dismiss. The host sets `status` to `dismissed`; nothing changed. */
|
|
24
|
+
onDismiss?: () => void;
|
|
25
|
+
/** Called by Undo on a confirmed card, shown only when this is set. The host reverses the change and sets `status` to `undone`. */
|
|
26
|
+
onUndo?: () => void;
|
|
27
|
+
/** The Confirm button's words. Defaults to "Confirm". */
|
|
28
|
+
confirmLabel?: string;
|
|
29
|
+
/** The Dismiss button's words. Not "Cancel", which beside a cancellation reads as the action itself. Defaults to "Dismiss". */
|
|
30
|
+
dismissLabel?: string;
|
|
31
|
+
/** The Undo button's words. Defaults to "Undo". */
|
|
32
|
+
undoLabel?: string;
|
|
33
|
+
/** The read-out where Confirm stood, on a confirmed card that keeps its `facts`. Defaults to "Confirmed". */
|
|
34
|
+
confirmedLabel?: string;
|
|
35
|
+
/** What a dismissed card says after its title. Defaults to "Not changed". */
|
|
36
|
+
dismissedLabel?: string;
|
|
37
|
+
/** What an undone card says after its title. Defaults to "Undone". */
|
|
38
|
+
undoneLabel?: string;
|
|
39
|
+
/** Additional CSS classes */
|
|
40
|
+
className?: string;
|
|
41
|
+
};
|
|
42
|
+
export interface ActionCardProps extends ActionCardOwnProps, Omit<React.ComponentPropsWithRef<'div'>, keyof ActionCardOwnProps> {
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A change an assistant proposes and the reader confirms: what it does and what
|
|
46
|
+
* it leaves alone, with Confirm and Dismiss, then the record of what happened,
|
|
47
|
+
* with Undo while it can be reversed. The card never makes the change itself:
|
|
48
|
+
* the host does, from `onConfirm`, through the same action its own buttons use.
|
|
49
|
+
* The record is announced as a status, so a confirmation is heard as well as seen.
|
|
50
|
+
* Hook-free, so its records render from a Server Component; its buttons are
|
|
51
|
+
* Button's own client islands.
|
|
52
|
+
*/
|
|
53
|
+
export declare function ActionCard({ ref, title, detail, facts, icon, status, receipt, tone, onConfirm, onDismiss, onUndo, confirmLabel, dismissLabel, undoLabel, confirmedLabel, dismissedLabel, undoneLabel, className, ...rest }: ActionCardProps): React.JSX.Element;
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Button } from "../Button/Button.js";
|
|
4
|
+
import "./ActionCard.css";
|
|
5
|
+
import "../../behaviors/chat-card.css";
|
|
6
|
+
import "../../fonts/material-symbols.css";
|
|
7
|
+
import { mirrorClass } from "../../behaviors/direction.js";
|
|
8
|
+
const baseClass = "ds-action-card";
|
|
9
|
+
function ActionCard({
|
|
10
|
+
ref,
|
|
11
|
+
title,
|
|
12
|
+
detail,
|
|
13
|
+
facts,
|
|
14
|
+
icon,
|
|
15
|
+
status = "proposed",
|
|
16
|
+
receipt,
|
|
17
|
+
tone = "default",
|
|
18
|
+
onConfirm,
|
|
19
|
+
onDismiss,
|
|
20
|
+
onUndo,
|
|
21
|
+
confirmLabel = "Confirm",
|
|
22
|
+
dismissLabel = "Dismiss",
|
|
23
|
+
undoLabel = "Undo",
|
|
24
|
+
confirmedLabel = "Confirmed",
|
|
25
|
+
dismissedLabel = "Not changed",
|
|
26
|
+
undoneLabel = "Undone",
|
|
27
|
+
className = "",
|
|
28
|
+
...rest
|
|
29
|
+
}) {
|
|
30
|
+
const mark = icon ? /* @__PURE__ */ jsx("span", { className: `${baseClass}__icon`, "aria-hidden": "true", children: typeof icon === "string" ? /* @__PURE__ */ jsx("span", { className: `material-symbols-rounded ${mirrorClass(icon)}`, children: icon }) : icon }) : null;
|
|
31
|
+
const factList = facts?.length ? /* @__PURE__ */ jsx("dl", { className: `ds-chat-card-facts ${baseClass}__facts`, children: facts.map((fact, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
32
|
+
/* @__PURE__ */ jsx("dt", { children: fact.label }),
|
|
33
|
+
/* @__PURE__ */ jsx("dd", { children: fact.value })
|
|
34
|
+
] }, `${index}-${fact.label}`)) }) : null;
|
|
35
|
+
if (status === "confirmed" && factList) {
|
|
36
|
+
return /* @__PURE__ */ jsxs("div", { ...rest, ref, className: [baseClass, `${baseClass}--confirmed`, `${baseClass}--detailed`, className].filter(Boolean).join(" "), children: [
|
|
37
|
+
/* @__PURE__ */ jsxs("span", { className: `${baseClass}__head`, children: [
|
|
38
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__title`, role: "status", children: receipt ?? title }),
|
|
39
|
+
onUndo && /* @__PURE__ */ jsx(Button, { variant: "tertiary", size: "compact", iconLeft: "undo", label: undoLabel, onClick: onUndo })
|
|
40
|
+
] }),
|
|
41
|
+
factList,
|
|
42
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__actions`, children: /* @__PURE__ */ jsxs("span", { className: `ds-chat-card-readout ds-chat-card-readout--positive ${baseClass}__readout`, children: [
|
|
43
|
+
/* @__PURE__ */ jsx("span", { className: `ds-chat-card-readout__icon ${baseClass}__readout-icon material-symbols-rounded`, "aria-hidden": "true", children: "check" }),
|
|
44
|
+
confirmedLabel
|
|
45
|
+
] }) })
|
|
46
|
+
] });
|
|
47
|
+
}
|
|
48
|
+
if (status !== "proposed") {
|
|
49
|
+
return /* @__PURE__ */ jsxs("div", { ...rest, ref, className: [baseClass, `${baseClass}--${status}`, className].filter(Boolean).join(" "), children: [
|
|
50
|
+
/* @__PURE__ */ jsxs("span", { className: `${baseClass}__record`, role: "status", children: [
|
|
51
|
+
!(status === "confirmed" && onUndo) && mark,
|
|
52
|
+
/* @__PURE__ */ jsxs("span", { className: `${baseClass}__record-text`, children: [
|
|
53
|
+
status === "confirmed" ? receipt ?? title : title,
|
|
54
|
+
status !== "confirmed" && /* @__PURE__ */ jsx("span", { className: `${baseClass}__record-note`, children: status === "dismissed" ? dismissedLabel : undoneLabel })
|
|
55
|
+
] })
|
|
56
|
+
] }),
|
|
57
|
+
status === "confirmed" && onUndo && /* @__PURE__ */ jsx(Button, { variant: "tertiary", size: "compact", iconLeft: "undo", label: undoLabel, onClick: onUndo })
|
|
58
|
+
] });
|
|
59
|
+
}
|
|
60
|
+
return /* @__PURE__ */ jsxs("div", { ...rest, ref, className: [baseClass, `${baseClass}--proposed`, className].filter(Boolean).join(" "), children: [
|
|
61
|
+
/* @__PURE__ */ jsxs("span", { className: `${baseClass}__title`, children: [
|
|
62
|
+
mark,
|
|
63
|
+
title
|
|
64
|
+
] }),
|
|
65
|
+
detail && /* @__PURE__ */ jsx("span", { className: `${baseClass}__detail`, children: detail }),
|
|
66
|
+
factList,
|
|
67
|
+
/* @__PURE__ */ jsxs("span", { className: `${baseClass}__actions`, children: [
|
|
68
|
+
/* @__PURE__ */ jsx(Button, { variant: "primary", tone, size: "compact", label: confirmLabel, onClick: onConfirm }),
|
|
69
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", tone: "neutral", size: "compact", label: dismissLabel, onClick: onDismiss })
|
|
70
|
+
] })
|
|
71
|
+
] });
|
|
72
|
+
}
|
|
73
|
+
export {
|
|
74
|
+
ActionCard
|
|
75
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
ACTION READOUT COMPONENT
|
|
3
|
+
What a confirmed change did: a title over
|
|
4
|
+
a two-column list of facts, label beside
|
|
5
|
+
value. A content card of the chat furniture,
|
|
6
|
+
on ActionCard's surface, so a proposal and
|
|
7
|
+
its readout read as one family.
|
|
8
|
+
============================================ */
|
|
9
|
+
|
|
10
|
+
.ds-action-readout {
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
/* The facts are the title's body. */
|
|
15
|
+
gap: var(--ds-chat-card-gap-text);
|
|
16
|
+
width: 100%;
|
|
17
|
+
min-width: 0;
|
|
18
|
+
padding: var(--ds-chat-card-edge) var(--ds-chat-card-inset);
|
|
19
|
+
border: var(--ds-chat-card-border);
|
|
20
|
+
border-radius: var(--ds-chat-card-radius);
|
|
21
|
+
background-color: var(--ds-chat-card-bg);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.ds-action-readout__title {
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
gap: var(--gap-200);
|
|
28
|
+
font-family: var(--font-title-body-family);
|
|
29
|
+
font-size: var(--font-title-body-size);
|
|
30
|
+
font-weight: var(--font-title-body-weight);
|
|
31
|
+
line-height: var(--font-title-body-line-height);
|
|
32
|
+
letter-spacing: var(--font-title-body-letter-spacing);
|
|
33
|
+
color: var(--color-text-primary);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.ds-action-readout__icon {
|
|
37
|
+
display: inline-flex;
|
|
38
|
+
flex-shrink: 0;
|
|
39
|
+
/* A title's icon trails it, so the card's text starts on its inset edge. */
|
|
40
|
+
order: 1;
|
|
41
|
+
margin-inline-start: auto;
|
|
42
|
+
--icon-size: var(--icon-size-500);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ds-action-readout .material-symbols-rounded {
|
|
46
|
+
color: inherit;
|
|
47
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/** One line of a readout: what it measures and its value, already written in the reader's locale. */
|
|
3
|
+
export interface ActionReadoutFact {
|
|
4
|
+
/** What it measures: "Refunded". */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Its value: "$101,137 across 52 orders". */
|
|
7
|
+
value: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/** Props owned by ActionReadout itself — everything else falls through to the root `<div>`. */
|
|
10
|
+
type ActionReadoutOwnProps = {
|
|
11
|
+
/** What was done, with how much: "69 orders cancelled". Collides with the native `title` tooltip attribute on purpose: the readout shows it. */
|
|
12
|
+
title: React.ReactNode;
|
|
13
|
+
/** What it did, a line each: the status it moved, the money it touched, who it reached. */
|
|
14
|
+
facts: ActionReadoutFact[];
|
|
15
|
+
/** A leading mark beside the title: a Material Symbol name, or your own element. */
|
|
16
|
+
icon?: string | React.ReactNode;
|
|
17
|
+
/** Additional CSS classes */
|
|
18
|
+
className?: string;
|
|
19
|
+
};
|
|
20
|
+
export interface ActionReadoutProps extends ActionReadoutOwnProps, Omit<React.ComponentPropsWithRef<'div'>, keyof ActionReadoutOwnProps> {
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* What a confirmed change did, as the opening of the reply its confirmation
|
|
24
|
+
* gets: a title over a list of facts, worked out by the host from the
|
|
25
|
+
* records as they were just before the change, so it is exact without a model.
|
|
26
|
+
* The facts are a description list, so each label is read with its value.
|
|
27
|
+
*/
|
|
28
|
+
export declare function ActionReadout({ ref, title, facts, icon, className, ...rest }: ActionReadoutProps): React.JSX.Element;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import "./ActionReadout.css";
|
|
4
|
+
import "../../behaviors/chat-card.css";
|
|
5
|
+
import "../../fonts/material-symbols.css";
|
|
6
|
+
import { mirrorClass } from "../../behaviors/direction.js";
|
|
7
|
+
const baseClass = "ds-action-readout";
|
|
8
|
+
function ActionReadout({ ref, title, facts, icon, className = "", ...rest }) {
|
|
9
|
+
return /* @__PURE__ */ jsxs("div", { ...rest, ref, className: [baseClass, className].filter(Boolean).join(" "), children: [
|
|
10
|
+
/* @__PURE__ */ jsxs("span", { className: `${baseClass}__title`, children: [
|
|
11
|
+
icon && /* @__PURE__ */ jsx("span", { className: `${baseClass}__icon`, "aria-hidden": "true", children: typeof icon === "string" ? /* @__PURE__ */ jsx("span", { className: `material-symbols-rounded ${mirrorClass(icon)}`, children: icon }) : icon }),
|
|
12
|
+
title
|
|
13
|
+
] }),
|
|
14
|
+
/* @__PURE__ */ jsx("dl", { className: `ds-chat-card-facts ${baseClass}__facts`, children: facts.map((fact, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
15
|
+
/* @__PURE__ */ jsx("dt", { children: fact.label }),
|
|
16
|
+
/* @__PURE__ */ jsx("dd", { children: fact.value })
|
|
17
|
+
] }, `${index}-${fact.label}`)) })
|
|
18
|
+
] });
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
ActionReadout
|
|
22
|
+
};
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
display: flex;
|
|
15
15
|
flex-direction: column;
|
|
16
16
|
width: 100%;
|
|
17
|
-
background-color: var(--
|
|
18
|
-
border: var(--
|
|
17
|
+
background-color: var(--ds-chat-card-bg);
|
|
18
|
+
border: var(--ds-chat-card-border);
|
|
19
19
|
/* The chat furniture's shared 24px shell — see ToolCall. */
|
|
20
|
-
border-radius: var(--radius
|
|
20
|
+
border-radius: var(--ds-chat-card-radius);
|
|
21
21
|
overflow: hidden;
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -30,8 +30,11 @@
|
|
|
30
30
|
align-items: center;
|
|
31
31
|
gap: var(--gap-200);
|
|
32
32
|
width: 100%;
|
|
33
|
-
/*
|
|
34
|
-
|
|
33
|
+
/* The chat cards' one-row height: a compact control and 4px above and
|
|
34
|
+
below, so a label row and a row holding a button are the same height. */
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
min-height: var(--ds-chat-card-row-height);
|
|
37
|
+
padding: var(--ds-chat-card-row-pad) var(--ds-chat-card-inset);
|
|
35
38
|
background: none;
|
|
36
39
|
border: none;
|
|
37
40
|
text-align: start;
|
|
@@ -111,7 +114,9 @@
|
|
|
111
114
|
min-height: 0;
|
|
112
115
|
}
|
|
113
116
|
|
|
114
|
-
|
|
117
|
+
/* The divider lives on the steps inside the clip, in both states, so it
|
|
118
|
+
travels with the opening row instead of snapping in on its first frame. */
|
|
119
|
+
.ds-agent-plan__steps {
|
|
115
120
|
border-top: var(--border-025) solid var(--color-divider);
|
|
116
121
|
}
|
|
117
122
|
|
|
@@ -123,7 +128,9 @@
|
|
|
123
128
|
display: flex;
|
|
124
129
|
flex-direction: column;
|
|
125
130
|
margin: 0;
|
|
126
|
-
|
|
131
|
+
/* With each step's own 4px, the first and last rows sit 12px off the
|
|
132
|
+
divider and the card's edge, every chat card's edge inset. */
|
|
133
|
+
padding: var(--padding-200) var(--ds-chat-card-inset);
|
|
127
134
|
list-style: none;
|
|
128
135
|
}
|
|
129
136
|
|
|
@@ -141,7 +148,7 @@
|
|
|
141
148
|
position: absolute;
|
|
142
149
|
top: calc(var(--padding-100) + var(--icon-size-500));
|
|
143
150
|
bottom: calc(-1 * var(--padding-100));
|
|
144
|
-
inset-inline-start: calc(var(--icon-size-500) / 2);
|
|
151
|
+
inset-inline-start: calc(var(--icon-size-500) / 2 - var(--padding-050));
|
|
145
152
|
width: var(--border-025);
|
|
146
153
|
background-color: var(--color-divider);
|
|
147
154
|
}
|
|
@@ -156,6 +163,9 @@
|
|
|
156
163
|
off the connector's centre line. */
|
|
157
164
|
width: var(--icon-size-500);
|
|
158
165
|
height: var(--icon-size-500);
|
|
166
|
+
/* Optical: a status glyph draws its circle 2px inside its box, so the
|
|
167
|
+
marker steps back by that much to stand on the text's edge above. */
|
|
168
|
+
margin-inline-start: calc(-1 * var(--padding-050));
|
|
159
169
|
color: var(--color-icon-secondary);
|
|
160
170
|
}
|
|
161
171
|
|
|
@@ -3,6 +3,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import React, { useId, useState, useCallback } from "react";
|
|
4
4
|
import { Spinner } from "../Spinner/Spinner.js";
|
|
5
5
|
import "./AgentPlan.css";
|
|
6
|
+
import "../../behaviors/chat-card.css";
|
|
6
7
|
import "../../behaviors/visually-hidden.css";
|
|
7
8
|
import "../../fonts/material-symbols.css";
|
|
8
9
|
const STEP_ICONS = {
|
|
@@ -513,6 +513,15 @@
|
|
|
513
513
|
pointer-events: auto;
|
|
514
514
|
}
|
|
515
515
|
|
|
516
|
+
/* A persistent top slot never fades: it holds the nav rows' inset, so a
|
|
517
|
+
mark at its start stays on the rail's axis through the sweep, and its
|
|
518
|
+
content fades whatever it hides itself. */
|
|
519
|
+
.ds-app-sidebar__top-slot--persistent {
|
|
520
|
+
padding: 0 var(--padding-300);
|
|
521
|
+
opacity: 1;
|
|
522
|
+
pointer-events: auto;
|
|
523
|
+
}
|
|
524
|
+
|
|
516
525
|
/* The footer's two forms share one cell, so the slot keeps one height in
|
|
517
526
|
both states and the rail's layout never snaps: the expanded form fades
|
|
518
527
|
out as the collapsed form fades in, the inverse of the rules above. The
|
|
@@ -747,12 +756,9 @@
|
|
|
747
756
|
padding-inline-start: calc(var(--padding-500) + var(--padding-200));
|
|
748
757
|
}
|
|
749
758
|
|
|
759
|
+
/* The rows keep the expanded rail's gap while collapsed too, so a
|
|
760
|
+
selected indicator never sits flush under the caption above it. */
|
|
750
761
|
.ds-app-sidebar--panel-mode .ds-app-sidebar__nav {
|
|
751
|
-
gap: 0;
|
|
752
|
-
transition: gap var(--motion-duration-slow) var(--motion-ease-emphasized);
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
.ds-app-sidebar--panel-mode.ds-app-sidebar--expanded .ds-app-sidebar__nav {
|
|
756
762
|
gap: var(--gap-100);
|
|
757
763
|
}
|
|
758
764
|
|
|
@@ -116,6 +116,8 @@ type AppSidebarOwnProps = {
|
|
|
116
116
|
floating?: boolean;
|
|
117
117
|
/** Rendered under the logo row, above the nav; fades out while collapsed */
|
|
118
118
|
topSlot?: React.ReactNode;
|
|
119
|
+
/** Keeps `topSlot` shown while collapsed instead of fading it, clipped by the sweeping rail as the nav rows are, for content that draws its own collapsed form: a switcher that holds its mark on the rail's axis and fades the rest. The slot carries `data-expanded`, so its content can key off the rail's state */
|
|
120
|
+
persistentTopSlot?: boolean;
|
|
119
121
|
/** Rendered above the profile block; fades out while collapsed */
|
|
120
122
|
footerSlot?: React.ReactNode;
|
|
121
123
|
/** Rendered above the profile block while the rail is collapsed, in `footerSlot`'s place: the same controls at their smallest, such as a SegmentedControl's or ThemeToggle's `cycle` circle, stacked and centred on the rail's axis. The two forms share one cell and crossfade with the rail, and whichever is hidden is inert */
|
|
@@ -52,6 +52,7 @@ const AppSidebar = React.forwardRef(function AppSidebar2({
|
|
|
52
52
|
layout: layoutProp,
|
|
53
53
|
floating: floatingProp = false,
|
|
54
54
|
topSlot,
|
|
55
|
+
persistentTopSlot = false,
|
|
55
56
|
footerSlot,
|
|
56
57
|
collapsedFooterSlot,
|
|
57
58
|
className = "",
|
|
@@ -308,7 +309,18 @@ const AppSidebar = React.forwardRef(function AppSidebar2({
|
|
|
308
309
|
}
|
|
309
310
|
)
|
|
310
311
|
] }),
|
|
311
|
-
topSlot && /* @__PURE__ */ jsx(
|
|
312
|
+
topSlot && /* @__PURE__ */ jsx(
|
|
313
|
+
"div",
|
|
314
|
+
{
|
|
315
|
+
className: [
|
|
316
|
+
`${baseClass}__top-slot`,
|
|
317
|
+
persistentTopSlot ? `${baseClass}__top-slot--persistent` : ""
|
|
318
|
+
].filter(Boolean).join(" "),
|
|
319
|
+
"data-expanded": showExpanded,
|
|
320
|
+
inert: !showExpanded && !persistentTopSlot,
|
|
321
|
+
children: topSlot
|
|
322
|
+
}
|
|
323
|
+
),
|
|
312
324
|
mobileOpen && drilled && panelSource ? /* @__PURE__ */ jsx(
|
|
313
325
|
SidebarPanel,
|
|
314
326
|
{
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
display: flex;
|
|
13
13
|
align-items: center;
|
|
14
14
|
gap: var(--gap-300);
|
|
15
|
+
/* The column's full width, like every chat card. */
|
|
15
16
|
width: 100%;
|
|
16
|
-
max-width: 360px;
|
|
17
17
|
padding: var(--padding-300);
|
|
18
|
-
border: var(--
|
|
19
|
-
border-radius: var(--radius
|
|
20
|
-
background-color: var(--
|
|
18
|
+
border: var(--ds-chat-card-border);
|
|
19
|
+
border-radius: var(--ds-chat-card-radius);
|
|
20
|
+
background-color: var(--ds-chat-card-bg);
|
|
21
21
|
cursor: pointer;
|
|
22
22
|
text-align: start;
|
|
23
23
|
transition:
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
on-stage one, so it stays a tile on the card instead of dissolving into
|
|
47
47
|
a fill of nearly its own value. */
|
|
48
48
|
.ds-artifact-card--open .ds-artifact-card__mark {
|
|
49
|
-
background-color: var(--
|
|
49
|
+
background-color: var(--ds-chat-card-bg);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
.ds-artifact-card__mark {
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
/* Concentric with the card: its radius less the padding between them,
|
|
61
61
|
computed from the live tokens so the corner holds under any theme's
|
|
62
62
|
radius scale, and squares off with a squared theme. */
|
|
63
|
-
border-radius: max(0px, calc(var(--radius
|
|
63
|
+
border-radius: max(0px, calc(var(--ds-chat-card-radius) - var(--padding-300)));
|
|
64
64
|
background-color: var(--color-bg-container-secondary);
|
|
65
65
|
color: var(--color-icon-primary);
|
|
66
66
|
}
|
|
@@ -76,10 +76,11 @@
|
|
|
76
76
|
overflow: hidden;
|
|
77
77
|
text-overflow: ellipsis;
|
|
78
78
|
white-space: nowrap;
|
|
79
|
-
font-family: var(--font-
|
|
80
|
-
font-size: var(--font-
|
|
81
|
-
font-weight: var(--font-
|
|
82
|
-
line-height: var(--font-
|
|
79
|
+
font-family: var(--font-title-body-family);
|
|
80
|
+
font-size: var(--font-title-body-size);
|
|
81
|
+
font-weight: var(--font-title-body-weight);
|
|
82
|
+
line-height: var(--font-title-body-line-height);
|
|
83
|
+
letter-spacing: var(--font-title-body-letter-spacing);
|
|
83
84
|
color: var(--color-text-primary);
|
|
84
85
|
}
|
|
85
86
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import "./ArtifactCard.css";
|
|
4
|
+
import "../../behaviors/chat-card.css";
|
|
4
5
|
import "../../fonts/material-symbols.css";
|
|
5
6
|
import { mirrorClass } from "../../behaviors/direction.js";
|
|
6
7
|
const baseClass = "ds-artifact-card";
|
|
8
|
+
const cueIcon = (open) => open ? "right_panel_close" : "right_panel_open";
|
|
7
9
|
const ArtifactCard = React.forwardRef(
|
|
8
10
|
({ title, meta, icon = "draft", open = false, className = "", ...rest }, ref) => /* @__PURE__ */ jsxs(
|
|
9
11
|
"button",
|
|
@@ -19,7 +21,7 @@ const ArtifactCard = React.forwardRef(
|
|
|
19
21
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__title`, children: title }),
|
|
20
22
|
meta && /* @__PURE__ */ jsx("span", { className: `${baseClass}__meta`, children: meta })
|
|
21
23
|
] }),
|
|
22
|
-
/* @__PURE__ */ jsx("span", { className: `${baseClass}__cue material-symbols-rounded`, "aria-hidden": "true", children: open
|
|
24
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__cue material-symbols-rounded ${mirrorClass(cueIcon(open))}`, "aria-hidden": "true", children: cueIcon(open) })
|
|
23
25
|
]
|
|
24
26
|
}
|
|
25
27
|
)
|
|
@@ -114,8 +114,11 @@
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
/* The passive ramp is a ghost family meant to paint over a surface, so
|
|
117
|
-
the floating pill supplies its own:
|
|
118
|
-
|
|
117
|
+
the floating pill supplies its own: the app surface + border below, the
|
|
118
|
+
passive layer above stepping through rest, hover, and active. Opaque, so
|
|
119
|
+
the text scrolling under it never shows through (the container surface
|
|
120
|
+
is translucent in dark mode), and never frosted: the thread's edge-fade
|
|
121
|
+
mask stops a backdrop blur inside the scroller from seeing that text. */
|
|
119
122
|
.ds-chat-thread__jump {
|
|
120
123
|
display: flex;
|
|
121
124
|
align-items: center;
|
|
@@ -127,7 +130,7 @@
|
|
|
127
130
|
padding: 0;
|
|
128
131
|
border: var(--border-025) solid var(--color-bg-container-border);
|
|
129
132
|
border-radius: var(--radius-pill);
|
|
130
|
-
background-color: var(--color-bg-
|
|
133
|
+
background-color: var(--color-bg-app-surface);
|
|
131
134
|
background-image: linear-gradient(
|
|
132
135
|
var(--color-action-passive-bg),
|
|
133
136
|
var(--color-action-passive-bg)
|