rift-ds 1.22.0 → 1.24.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/behaviors/shell.css +119 -0
- package/bin/templates/blocks/components/blocks/AppShell.module.css +69 -15
- package/bin/templates/blocks/components/blocks/AppShell.tsx +45 -30
- package/bin/templates/blocks/registry.json +1 -1
- package/chat/AssistantTurn.js +9 -3
- package/chat/ChatAgentPane.css +6 -6
- package/chat/ChatLauncher.d.ts +3 -3
- package/chat/ChatLauncher.js +3 -5
- package/chat/ChatProvider.d.ts +10 -1
- package/chat/ChatProvider.js +3 -2
- package/chat/ChatWidget.css +272 -8
- package/chat/ChatWidget.d.ts +63 -9
- package/chat/ChatWidget.js +110 -38
- 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 +5 -3
- 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/AppLayout/AppLayout.css +17 -4
- package/components/AppLayout/AppLayout.d.ts +8 -5
- package/components/AppLayout/AppLayout.js +2 -0
- package/components/AppSidebar/AppSidebar.css +119 -28
- package/components/AppSidebar/AppSidebar.d.ts +10 -5
- package/components/AppSidebar/AppSidebar.js +19 -4
- 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/ThemePicker/ThemePicker.css +6 -0
- package/components/ThemePicker/ThemePicker.js +20 -11
- package/components/ThreadPanel/ThreadPanel.css +65 -36
- package/components/ThreadPanel/ThreadPanel.d.ts +5 -5
- package/components/ThreadPanel/ThreadPanel.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 +25 -1
- package/components/registry.json.d.ts +25 -1
- 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 +413 -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 +6 -2
- package/tokens/tokens-light.css +6 -2
- package/tokens/tokens-typography.css +8 -2
- package/tokens/values.json.js +1 -1
|
@@ -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 = {
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
.ds-app-layout {
|
|
7
7
|
display: flex;
|
|
8
8
|
min-height: 100vh;
|
|
9
|
-
|
|
9
|
+
/* The shell recipe's plane (src/behaviors/shell.css), set per layout by
|
|
10
|
+
the data-ds-shell marker on this root. */
|
|
11
|
+
background-color: var(--ds-shell-plane);
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
/* ============================================
|
|
@@ -27,6 +29,12 @@
|
|
|
27
29
|
--ds-app-layout-rail: 280px;
|
|
28
30
|
}
|
|
29
31
|
|
|
32
|
+
/* Flush: the content column is the crisp surface, running from the rail's
|
|
33
|
+
divider to the far edge. */
|
|
34
|
+
.ds-app-layout:not(.ds-app-layout--floating, .ds-app-layout--inset) .ds-app-layout__main {
|
|
35
|
+
background-color: var(--ds-shell-surface);
|
|
36
|
+
}
|
|
37
|
+
|
|
30
38
|
/* Panel mode's collapsed rail is the wider, labelled one. */
|
|
31
39
|
.ds-app-layout:not(.ds-app-layout--expanded):has(.ds-app-sidebar--panel-mode) {
|
|
32
40
|
--ds-app-layout-rail: 80px;
|
|
@@ -71,7 +79,6 @@
|
|
|
71
79
|
.ds-app-layout--inset {
|
|
72
80
|
height: 100dvh;
|
|
73
81
|
min-height: 0;
|
|
74
|
-
background-color: var(--color-bg-app-shell);
|
|
75
82
|
}
|
|
76
83
|
|
|
77
84
|
.ds-app-layout--inset .ds-app-layout__main {
|
|
@@ -85,8 +92,12 @@
|
|
|
85
92
|
min-width: 0;
|
|
86
93
|
display: flex;
|
|
87
94
|
overflow: hidden;
|
|
88
|
-
|
|
89
|
-
|
|
95
|
+
/* The raised surface: the floating rail's edge turned around, from the
|
|
96
|
+
shell recipe. */
|
|
97
|
+
background-color: var(--ds-shell-surface);
|
|
98
|
+
border: var(--border-025) solid var(--ds-shell-surface-border);
|
|
99
|
+
border-radius: var(--ds-shell-surface-radius);
|
|
100
|
+
box-shadow: var(--ds-shell-surface-shadow);
|
|
90
101
|
}
|
|
91
102
|
|
|
92
103
|
.ds-app-layout__scroller {
|
|
@@ -140,7 +151,9 @@
|
|
|
140
151
|
|
|
141
152
|
.ds-app-layout__surface {
|
|
142
153
|
overflow: visible;
|
|
154
|
+
border: none;
|
|
143
155
|
border-radius: 0;
|
|
156
|
+
box-shadow: none;
|
|
144
157
|
}
|
|
145
158
|
|
|
146
159
|
.ds-app-layout__scroller {
|
|
@@ -24,11 +24,14 @@ type AppLayoutOwnProps = {
|
|
|
24
24
|
/** Page content — centred in the main area */
|
|
25
25
|
children: React.ReactNode;
|
|
26
26
|
/**
|
|
27
|
-
* How the rail and the content meet the page
|
|
28
|
-
* the rail edge to edge
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
27
|
+
* How the rail and the content meet the page, one of the three app shell
|
|
28
|
+
* modes. `flush` (the default) runs the rail edge to edge on the shell
|
|
29
|
+
* colour behind a hairline, the content centred beside it on the crisp
|
|
30
|
+
* app surface, nothing raised. `floating` floats the rail as a glass card,
|
|
31
|
+
* the content still centred. `inset` runs the rail flush on the shell
|
|
32
|
+
* colour and sets the content full width in a raised surface (hairline
|
|
33
|
+
* and floating shadow) inset from the other edges, which scrolls inside
|
|
34
|
+
* itself.
|
|
32
35
|
*/
|
|
33
36
|
layout?: AppSidebarLayout;
|
|
34
37
|
/**
|
|
@@ -3,6 +3,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import React, { useState, useCallback, useRef, useEffect } from "react";
|
|
4
4
|
import { AppSidebar } from "../AppSidebar/AppSidebar.js";
|
|
5
5
|
import { MOTION_SCROLL_SETTLE_MS } from "../../tokens/motion.js";
|
|
6
|
+
import "../../behaviors/shell.css";
|
|
6
7
|
import "./AppLayout.css";
|
|
7
8
|
const AppLayout = React.forwardRef(
|
|
8
9
|
({
|
|
@@ -50,6 +51,7 @@ const AppLayout = React.forwardRef(
|
|
|
50
51
|
ref,
|
|
51
52
|
className: classes,
|
|
52
53
|
...theme === "dark" ? { "data-theme": "dark" } : {},
|
|
54
|
+
"data-ds-shell": layout,
|
|
53
55
|
children: [
|
|
54
56
|
/* @__PURE__ */ jsx(
|
|
55
57
|
AppSidebar,
|
|
@@ -21,7 +21,11 @@
|
|
|
21
21
|
/* The vertical padding sits inside the viewport height; content-box
|
|
22
22
|
sizing ran the rail 40px past the bottom and clipped the profile. */
|
|
23
23
|
box-sizing: border-box;
|
|
24
|
-
|
|
24
|
+
/* The flush rail, the shell recipe's (src/behaviors/shell.css): the
|
|
25
|
+
shell plane behind a hairline divider. A host that marks itself a
|
|
26
|
+
shell sets both; a rail standing alone takes the same look. */
|
|
27
|
+
background-color: var(--ds-shell-rail-bg, var(--color-bg-app-shell));
|
|
28
|
+
border-inline-end: var(--border-025) solid var(--ds-shell-rail-divider, var(--color-bg-container-border));
|
|
25
29
|
/* The logo mark draws in currentColor; without a colour of its own the
|
|
26
30
|
rail inherited the host's, and the mark vanished on a dark host. */
|
|
27
31
|
color: var(--color-text-primary);
|
|
@@ -49,13 +53,15 @@
|
|
|
49
53
|
top: var(--ds-sidebar-float-inset, 20px);
|
|
50
54
|
inset-inline-start: var(--ds-sidebar-float-inset, 20px);
|
|
51
55
|
height: calc(100dvh - var(--ds-sidebar-float-inset, 20px) * 2);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
/* The shell recipe's glass card (src/behaviors/shell.css), with its
|
|
57
|
+
values as fallbacks for a rail standing outside a shell host. */
|
|
58
|
+
background-color: var(--ds-shell-glass, var(--color-bg-glass));
|
|
59
|
+
border: var(--border-025) solid var(--ds-shell-edge-border, var(--color-bg-container-border));
|
|
60
|
+
border-radius: var(--ds-shell-radius, var(--radius-600));
|
|
61
|
+
box-shadow: var(--ds-shell-edge-shadow, var(--shadow-floating));
|
|
56
62
|
/* The glass token is deliberately translucent; this blur is what keeps
|
|
57
63
|
content behind the rail readable through it. */
|
|
58
|
-
backdrop-filter: blur(24px);
|
|
64
|
+
backdrop-filter: var(--ds-shell-glass-blur, blur(24px));
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
/* The inset layout's gap: between the content surface and the viewport
|
|
@@ -71,7 +77,9 @@
|
|
|
71
77
|
from the edges (AppLayout's inset layout)
|
|
72
78
|
============================================ */
|
|
73
79
|
.ds-app-sidebar--inset {
|
|
74
|
-
background-color: var(--color-bg-app-shell);
|
|
80
|
+
background-color: var(--ds-shell-rail-bg, var(--color-bg-app-shell));
|
|
81
|
+
/* The content surface's raised edge is the seam; the rail needs none. */
|
|
82
|
+
border-inline-end-color: transparent;
|
|
75
83
|
}
|
|
76
84
|
|
|
77
85
|
/* ============================================
|
|
@@ -85,6 +93,12 @@
|
|
|
85
93
|
overflow-x: hidden;
|
|
86
94
|
flex: 1;
|
|
87
95
|
min-height: 0;
|
|
96
|
+
/* The scroller clips at its edge, and the logo row sits on it: the
|
|
97
|
+
collapse toggle's hover pill, a --gap-100 step out from the icon, lost
|
|
98
|
+
its top to it. A pill's worth of room inside the top edge, taken back
|
|
99
|
+
from the rail's padding, so nothing moves. */
|
|
100
|
+
padding-top: var(--gap-100);
|
|
101
|
+
margin-top: calc(-1 * var(--gap-100));
|
|
88
102
|
}
|
|
89
103
|
|
|
90
104
|
/* ============================================
|
|
@@ -349,6 +363,15 @@
|
|
|
349
363
|
transition: opacity var(--motion-duration-base) var(--motion-ease-standard);
|
|
350
364
|
}
|
|
351
365
|
|
|
366
|
+
/* Collapsed, the row is a 40px circle, and its clip follows the curve: the
|
|
367
|
+
corner badge, which overhangs the icon seat's top end, lost its corner
|
|
368
|
+
to it. The collapsed row draws nothing that needs the clip (the label
|
|
369
|
+
and chevron truncate themselves, and the hover circle is the row's own
|
|
370
|
+
fill), so it lets the badge hang over. */
|
|
371
|
+
.ds-app-sidebar:not(.ds-app-sidebar--expanded) .ds-app-sidebar__btn {
|
|
372
|
+
overflow: visible;
|
|
373
|
+
}
|
|
374
|
+
|
|
352
375
|
.ds-app-sidebar--expanded .ds-app-sidebar__btn-corner-badge {
|
|
353
376
|
opacity: 0;
|
|
354
377
|
transition-duration: var(--motion-duration-fast);
|
|
@@ -513,6 +536,15 @@
|
|
|
513
536
|
pointer-events: auto;
|
|
514
537
|
}
|
|
515
538
|
|
|
539
|
+
/* A persistent top slot never fades: it holds the nav rows' inset, so a
|
|
540
|
+
mark at its start stays on the rail's axis through the sweep, and its
|
|
541
|
+
content fades whatever it hides itself. */
|
|
542
|
+
.ds-app-sidebar__top-slot--persistent {
|
|
543
|
+
padding: 0 var(--padding-300);
|
|
544
|
+
opacity: 1;
|
|
545
|
+
pointer-events: auto;
|
|
546
|
+
}
|
|
547
|
+
|
|
516
548
|
/* The footer's two forms share one cell, so the slot keeps one height in
|
|
517
549
|
both states and the rail's layout never snaps: the expanded form fades
|
|
518
550
|
out as the collapsed form fades in, the inverse of the rules above. The
|
|
@@ -527,6 +559,12 @@
|
|
|
527
559
|
grid-area: 1 / 1;
|
|
528
560
|
}
|
|
529
561
|
|
|
562
|
+
/* The footer's controls start on the rail's leading line, the logo's, the
|
|
563
|
+
row icons' and the avatar's, a step deeper than the top slot. */
|
|
564
|
+
.ds-app-sidebar__footer > .ds-app-sidebar__footer-slot:not(.ds-app-sidebar__footer-slot--collapsed) {
|
|
565
|
+
padding-inline: var(--padding-500);
|
|
566
|
+
}
|
|
567
|
+
|
|
530
568
|
.ds-app-sidebar__footer-slot--collapsed {
|
|
531
569
|
display: flex;
|
|
532
570
|
flex-direction: column;
|
|
@@ -590,12 +628,13 @@
|
|
|
590
628
|
opacity: 1;
|
|
591
629
|
}
|
|
592
630
|
|
|
631
|
+
/* The profile pairs its lines as EntitySwitcher does: the name in
|
|
632
|
+
paragraph-sm emphasis, the second line in caption, secondary. */
|
|
593
633
|
.ds-app-sidebar__profile-name {
|
|
594
|
-
font-family: var(--font-paragraph-emphasis-family);
|
|
595
|
-
font-size: var(--font-paragraph-emphasis-size);
|
|
596
|
-
font-weight: var(--font-paragraph-emphasis-weight);
|
|
597
|
-
line-height: var(--font-paragraph-emphasis-line-height);
|
|
598
|
-
letter-spacing: var(--font-paragraph-emphasis-letter-spacing);
|
|
634
|
+
font-family: var(--font-paragraph-sm-emphasis-family);
|
|
635
|
+
font-size: var(--font-paragraph-sm-emphasis-size);
|
|
636
|
+
font-weight: var(--font-paragraph-sm-emphasis-weight);
|
|
637
|
+
line-height: var(--font-paragraph-sm-emphasis-line-height);
|
|
599
638
|
color: var(--color-text-primary);
|
|
600
639
|
white-space: nowrap;
|
|
601
640
|
overflow: hidden;
|
|
@@ -603,11 +642,11 @@
|
|
|
603
642
|
}
|
|
604
643
|
|
|
605
644
|
.ds-app-sidebar__profile-email {
|
|
606
|
-
font-family: var(--font-
|
|
607
|
-
font-size: var(--font-
|
|
608
|
-
font-weight: var(--font-
|
|
609
|
-
line-height: var(--font-
|
|
610
|
-
color: var(--color-text-
|
|
645
|
+
font-family: var(--font-caption-family);
|
|
646
|
+
font-size: var(--font-caption-size);
|
|
647
|
+
font-weight: var(--font-caption-weight);
|
|
648
|
+
line-height: var(--font-caption-line-height);
|
|
649
|
+
color: var(--color-text-secondary);
|
|
611
650
|
white-space: nowrap;
|
|
612
651
|
overflow: hidden;
|
|
613
652
|
text-overflow: ellipsis;
|
|
@@ -693,11 +732,13 @@
|
|
|
693
732
|
top: var(--ds-sidebar-float-inset, 20px);
|
|
694
733
|
inset-inline-start: calc(var(--ds-sidebar-float-inset, 20px) + 64px + var(--gap-300));
|
|
695
734
|
height: calc(100dvh - var(--ds-sidebar-float-inset, 20px) * 2);
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
735
|
+
/* The shell recipe's glass card (src/behaviors/shell.css), with its
|
|
736
|
+
values as fallbacks for a rail standing outside a shell host. */
|
|
737
|
+
background-color: var(--ds-shell-glass, var(--color-bg-glass));
|
|
738
|
+
border: var(--border-025) solid var(--ds-shell-edge-border, var(--color-bg-container-border));
|
|
739
|
+
border-radius: var(--ds-shell-radius, var(--radius-600));
|
|
740
|
+
box-shadow: var(--ds-shell-edge-shadow, var(--shadow-floating));
|
|
741
|
+
backdrop-filter: var(--ds-shell-glass-blur, blur(24px));
|
|
701
742
|
}
|
|
702
743
|
|
|
703
744
|
.ds-app-sidebar__panel--floating.ds-app-sidebar__panel--panel-mode {
|
|
@@ -712,8 +753,16 @@
|
|
|
712
753
|
divider between the two levels, and the inset content surface starts
|
|
713
754
|
beyond both (AppLayout reserves the panel's width while it shows). The
|
|
714
755
|
trailing edge needs no border: the surface's own edge ends the panel. */
|
|
756
|
+
/* Flush: the panel continues the rail on its shell colour, and the rail's
|
|
757
|
+
own divider is the seam between them, so the panel's leading hairline
|
|
758
|
+
would double it. */
|
|
759
|
+
.ds-app-sidebar__panel:not(.ds-app-sidebar__panel--floating, .ds-app-sidebar__panel--inset) {
|
|
760
|
+
background-color: var(--ds-shell-rail-bg, var(--color-bg-app-shell));
|
|
761
|
+
border-inline-start-color: transparent;
|
|
762
|
+
}
|
|
763
|
+
|
|
715
764
|
.ds-app-sidebar__panel--inset {
|
|
716
|
-
background-color: var(--color-bg-app-shell);
|
|
765
|
+
background-color: var(--ds-shell-rail-bg, var(--color-bg-app-shell));
|
|
717
766
|
border-inline-end-color: transparent;
|
|
718
767
|
}
|
|
719
768
|
|
|
@@ -747,12 +796,9 @@
|
|
|
747
796
|
padding-inline-start: calc(var(--padding-500) + var(--padding-200));
|
|
748
797
|
}
|
|
749
798
|
|
|
799
|
+
/* The rows keep the expanded rail's gap while collapsed too, so a
|
|
800
|
+
selected indicator never sits flush under the caption above it. */
|
|
750
801
|
.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
802
|
gap: var(--gap-100);
|
|
757
803
|
}
|
|
758
804
|
|
|
@@ -986,3 +1032,48 @@
|
|
|
986
1032
|
.material-symbols-rounded:not(:where(.ds-app-sidebar__top-slot *, .ds-app-sidebar__footer-slot *)) {
|
|
987
1033
|
color: inherit;
|
|
988
1034
|
}
|
|
1035
|
+
|
|
1036
|
+
/* The toggle's pressed pill, ThreadPanel's: a passive hover and active fill
|
|
1037
|
+
a gap step out from the 24px icon, drawn behind it so the icon's box and
|
|
1038
|
+
the row's alignment stay as they are. Expanded only; collapsed, the toggle
|
|
1039
|
+
has no width to draw around. */
|
|
1040
|
+
.ds-app-sidebar__toggle-tip {
|
|
1041
|
+
flex: none;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
/* Collapsed, the rail is too narrow for the tooltip and the toggle is gone;
|
|
1045
|
+
the panel stays out of the way. */
|
|
1046
|
+
.ds-app-sidebar:not(.ds-app-sidebar--expanded) .ds-app-sidebar__toggle-tip .ds-tooltip__panel {
|
|
1047
|
+
display: none;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
/* In the phone drawer the toggle is the drawer's close, a glyph that names
|
|
1051
|
+
itself, and it takes the focus as the drawer opens: a tooltip there
|
|
1052
|
+
would rise over the brand name on every open, so the drawer has none. */
|
|
1053
|
+
.ds-app-sidebar--mobile-open .ds-app-sidebar__toggle-tip .ds-tooltip__panel {
|
|
1054
|
+
display: none;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
.ds-app-sidebar--expanded .ds-app-sidebar__toggle {
|
|
1058
|
+
position: relative;
|
|
1059
|
+
z-index: 0;
|
|
1060
|
+
overflow: visible;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
.ds-app-sidebar__toggle::before {
|
|
1064
|
+
content: '';
|
|
1065
|
+
position: absolute;
|
|
1066
|
+
inset: calc(-1 * var(--gap-100));
|
|
1067
|
+
z-index: -1;
|
|
1068
|
+
border-radius: var(--radius-pill);
|
|
1069
|
+
background-color: transparent;
|
|
1070
|
+
transition: background-color var(--motion-duration-fast) var(--motion-ease-standard);
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
.ds-app-sidebar__toggle:hover::before {
|
|
1074
|
+
background-color: var(--color-action-passive-bg-hover);
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
.ds-app-sidebar__toggle:active::before {
|
|
1078
|
+
background-color: var(--color-action-passive-bg-active);
|
|
1079
|
+
}
|
|
@@ -61,7 +61,7 @@ export interface AppSidebarProfile {
|
|
|
61
61
|
/** Avatar image URL */
|
|
62
62
|
avatarUrl?: string;
|
|
63
63
|
}
|
|
64
|
-
/**
|
|
64
|
+
/** The three app shell modes, how the rail meets the page: edge to edge behind a hairline, floating as a card, or flush beside a raised inset surface. */
|
|
65
65
|
export type AppSidebarLayout = 'flush' | 'floating' | 'inset';
|
|
66
66
|
/** Props owned by AppSidebar itself — everything else falls through to the `<nav>`. */
|
|
67
67
|
type AppSidebarOwnProps = {
|
|
@@ -99,13 +99,16 @@ type AppSidebarOwnProps = {
|
|
|
99
99
|
/** Callback when profile more button clicked */
|
|
100
100
|
onProfileMore?: () => void;
|
|
101
101
|
/**
|
|
102
|
-
* How the rail meets the page
|
|
103
|
-
*
|
|
102
|
+
* How the rail meets the page, one of the three app shell modes. `flush`
|
|
103
|
+
* runs it edge to edge on the shell colour behind a hairline divider,
|
|
104
|
+
* nothing raised. `floating` floats it off the viewport edges as a glass card:
|
|
104
105
|
* inset with rounded corners, the translucent glass fill over a backdrop
|
|
105
106
|
* blur, and the floating shadow (the inset defaults to 20px and is
|
|
106
107
|
* overridable via the --ds-sidebar-float-inset custom property). `inset`
|
|
107
|
-
* runs it flush on the app shell colour, beside a content surface
|
|
108
|
-
* from the edges, as AppLayout's `inset` layout draws it.
|
|
108
|
+
* runs it flush on the app shell colour, beside a raised content surface
|
|
109
|
+
* inset from the edges, as AppLayout's `inset` layout draws it. Inside a
|
|
110
|
+
* host that marks itself a shell (AppLayout, a chat or template page), the
|
|
111
|
+
* rail reads that host's mode from the shell recipe. Defaults to
|
|
109
112
|
* `flush` (or `floating` while the deprecated `floating` is set).
|
|
110
113
|
*/
|
|
111
114
|
layout?: AppSidebarLayout;
|
|
@@ -116,6 +119,8 @@ type AppSidebarOwnProps = {
|
|
|
116
119
|
floating?: boolean;
|
|
117
120
|
/** Rendered under the logo row, above the nav; fades out while collapsed */
|
|
118
121
|
topSlot?: React.ReactNode;
|
|
122
|
+
/** 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 */
|
|
123
|
+
persistentTopSlot?: boolean;
|
|
119
124
|
/** Rendered above the profile block; fades out while collapsed */
|
|
120
125
|
footerSlot?: React.ReactNode;
|
|
121
126
|
/** 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 */
|