rift-ds 1.38.0 → 1.40.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/shortcuts.js +2 -2
- package/behaviors/top-layer.css +28 -0
- package/behaviors/useAnchoredPosition.d.ts +12 -9
- package/behaviors/useAnchoredPosition.js +3 -0
- package/behaviors/useFoldedSections.d.ts +17 -0
- package/behaviors/useFoldedSections.js +23 -0
- package/behaviors/useLayer.d.ts +9 -0
- package/behaviors/useLayer.js +4 -3
- package/bin/rift-ds.mjs +3 -0
- package/bin/templates/blocks/app/notifications/Inbox.tsx +163 -0
- package/bin/templates/blocks/app/notifications/page.module.css +63 -0
- package/bin/templates/blocks/app/notifications/page.tsx +13 -0
- package/bin/templates/blocks/app/settings/Settings.tsx +483 -0
- package/bin/templates/blocks/app/settings/page.module.css +160 -6
- package/bin/templates/blocks/app/settings/page.tsx +10 -78
- package/bin/templates/blocks/components/blocks/AppShell.module.css +16 -244
- package/bin/templates/blocks/components/blocks/AppShell.tsx +274 -84
- package/bin/templates/blocks/registry.json +16 -3
- package/chat/ChatThreads.d.ts +63 -19
- package/chat/ChatThreads.js +119 -32
- package/chat/ChatWidget.css +15 -3
- package/chat/ChatWidget.d.ts +16 -17
- package/chat/ChatWidget.js +40 -7
- package/chat/DemoWelcome.d.ts +7 -0
- package/chat/DemoWelcome.js +19 -0
- package/chat/demo-fixtures.d.ts +1 -1
- package/chat/demo-fixtures.js +1 -0
- package/chat/rail-seat.d.ts +25 -0
- package/chat/rail-seat.js +8 -0
- package/chat/registry.json.d.ts +4 -1
- package/chat/registry.json.js +1 -1
- package/components/AppLayout/AppLayout.css +64 -0
- package/components/AppLayout/AppLayout.d.ts +21 -1
- package/components/AppLayout/AppLayout.js +9 -2
- package/components/AppSidebar/AppSidebar.css +378 -16
- package/components/AppSidebar/AppSidebar.d.ts +92 -4
- package/components/AppSidebar/AppSidebar.js +321 -155
- package/components/AppToolbar/AppToolbar.css +143 -0
- package/components/AppToolbar/AppToolbar.d.ts +124 -0
- package/components/AppToolbar/AppToolbar.js +119 -0
- package/components/ColourSwatch/ColourSwatch.css +49 -0
- package/components/ColourSwatch/ColourSwatch.d.ts +9 -1
- package/components/ColourSwatch/ColourSwatch.js +12 -1
- package/components/CommandPaletteTrigger/CommandPaletteTrigger.css +13 -0
- package/components/CommandPaletteTrigger/CommandPaletteTrigger.d.ts +7 -0
- package/components/CommandPaletteTrigger/CommandPaletteTrigger.js +2 -0
- package/components/Composer/Composer.css +20 -0
- package/components/Composer/Composer.d.ts +8 -0
- package/components/Composer/Composer.js +2 -0
- package/components/DrillMenu/DrillMenu.css +7 -0
- package/components/DrillMenu/DrillMenu.d.ts +6 -0
- package/components/DrillMenu/DrillMenu.js +2 -1
- package/components/NotificationCenter/NotificationCenter.css +145 -99
- package/components/NotificationCenter/NotificationCenter.d.ts +58 -4
- package/components/NotificationCenter/NotificationCenter.js +71 -63
- package/components/PaymentCard/PaymentCard.css +182 -0
- package/components/PaymentCard/PaymentCard.d.ts +80 -0
- package/components/PaymentCard/PaymentCard.js +80 -0
- package/components/PromptSuggestions/PromptSuggestions.css +180 -11
- package/components/PromptSuggestions/PromptSuggestions.d.ts +24 -3
- package/components/PromptSuggestions/PromptSuggestions.js +35 -9
- package/components/RadioButton/RadioButton.d.ts +2 -1
- package/components/RadioButton/RadioButton.js +1 -0
- package/components/ShaderScene/scenes.js +6 -5
- package/components/Stat/Stat.css +19 -19
- package/components/SubNavPanel/SubNavPanel.css +21 -0
- package/components/SubNavPanel/SubNavPanel.js +19 -2
- package/components/ThreadHistory/ThreadHistory.css +519 -0
- package/components/ThreadHistory/ThreadHistory.d.ts +90 -0
- package/components/ThreadHistory/ThreadHistory.js +344 -0
- package/components/ThreadPanel/ThreadPanel.css +90 -306
- package/components/ThreadPanel/ThreadPanel.d.ts +16 -0
- package/components/ThreadPanel/ThreadPanel.js +67 -241
- package/components/registry.json +57 -7
- package/components/registry.json.d.ts +57 -7
- package/components/registry.json.js +1 -1
- package/index.d.ts +3 -0
- package/index.js +6 -0
- package/package.json +1 -1
- package/tokens/presets/contrast.css +36 -19
- package/tokens/presets/coral.css +2 -0
- package/tokens/presets/forest.css +8 -0
- package/tokens/presets/pink.css +2 -0
- package/tokens/presets/violet.css +51 -21
- package/tokens/presets/zest.css +4 -0
- package/tokens/values.json.js +1 -1
- package/bin/templates/blocks/app/settings/ProfileForm.tsx +0 -98
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* The app shell every rift-ds block page sits in
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* The app shell every rift-ds app block page sits in, composed from the
|
|
5
|
+
* library's own shell pieces: AppLayout (its AppSidebar in one of the three
|
|
6
|
+
* app shell modes, SHELL_LAYOUT below, the default the sidebar's Appearance
|
|
7
|
+
* rows start from), an AppToolbar in AppLayout's toolbar slot (the search,
|
|
8
|
+
* the notifications, help, settings and the AI entry), and a PageHeader
|
|
9
|
+
* (breadcrumb, title, actions) over the page. This file is yours: rename the
|
|
10
|
+
* product, change the navigation, and grow it with your app.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* its icon, and the content runs edge to edge at a tighter gutter.
|
|
12
|
+
* Everything the shell does comes from those components, so it stays in
|
|
13
|
+
* step with the library: AppLayout pins the toolbar over the page as it
|
|
14
|
+
* scrolls, moves the page over while the sidebar's panel is open, sets the
|
|
15
|
+
* content in a raised surface in the inset mode, and on a phone turns the
|
|
16
|
+
* sidebar into a drawer behind its menu button. The toolbar folds itself by
|
|
17
|
+
* its own width: the AI entry to its icon, then the search, then the icon
|
|
18
|
+
* controls after the first into a More menu.
|
|
18
19
|
*/
|
|
19
20
|
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
type AppSidebarLayout,
|
|
25
|
-
type AppSidebarProfile,
|
|
26
|
-
type AppSidebarSection,
|
|
27
|
-
} from 'rift-ds/components/AppSidebar/AppSidebar';
|
|
21
|
+
import { useState, useSyncExternalStore, type ReactNode } from 'react';
|
|
22
|
+
import { AppLayout } from 'rift-ds/components/AppLayout/AppLayout';
|
|
23
|
+
import type { AppSidebarLayout, AppSidebarProfile, AppSidebarSection } from 'rift-ds/components/AppSidebar/AppSidebar';
|
|
24
|
+
import { AppToolbar } from 'rift-ds/components/AppToolbar/AppToolbar';
|
|
28
25
|
import type { BreadcrumbItem } from 'rift-ds/components/Breadcrumb/Breadcrumb';
|
|
26
|
+
import { NotificationCenter, NotificationItem } from 'rift-ds/components/NotificationCenter/NotificationCenter';
|
|
29
27
|
import { PageHeader } from 'rift-ds/components/PageHeader/PageHeader';
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
28
|
+
import { useColorMode } from 'rift-ds/components/ThemeToggle/useColorMode';
|
|
29
|
+
import { BREAKPOINT_MOBILE_PX, mediaBelow } from 'rift-ds/tokens/breakpoints';
|
|
30
|
+
import { SHIPPED_THEMES, shippedThemeOptions } from 'rift-ds/tokens/values';
|
|
31
|
+
// Every shipped theme, so a Theme pick applies; keep only yours once you choose.
|
|
32
|
+
import 'rift-ds/tokens/presets/presets.css';
|
|
33
33
|
import styles from './AppShell.module.css';
|
|
34
34
|
|
|
35
35
|
/**
|
|
@@ -41,12 +41,61 @@ import styles from './AppShell.module.css';
|
|
|
41
41
|
*/
|
|
42
42
|
const SHELL_LAYOUT: AppSidebarLayout = 'floating';
|
|
43
43
|
|
|
44
|
+
/** The sidebar's Appearance rows: what each choice is called and shows. */
|
|
45
|
+
const MODES = [
|
|
46
|
+
{ value: 'system', label: 'System', icon: 'routine', description: 'Follows your device' },
|
|
47
|
+
{ value: 'light', label: 'Light', icon: 'light_mode', description: 'Light surfaces, dark text' },
|
|
48
|
+
{ value: 'dark', label: 'Dark', icon: 'dark_mode', description: 'Dark surfaces, light text' },
|
|
49
|
+
] as const;
|
|
50
|
+
|
|
51
|
+
const LAYOUTS: { value: AppSidebarLayout; label: string; icon: string; description: string }[] = [
|
|
52
|
+
{ value: 'flush', label: 'Flush', icon: 'vertical_split', description: 'Edge to edge behind a hairline' },
|
|
53
|
+
{ value: 'floating', label: 'Floating', icon: 'view_sidebar', description: 'The sidebar as a card beside the page' },
|
|
54
|
+
{ value: 'inset', label: 'Inset', icon: 'space_dashboard', description: 'The page in a raised surface' },
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
const WIDTHS: { value: ContentWidth; label: string; icon: string; description: string }[] = [
|
|
58
|
+
{ value: 'narrow', label: 'Narrow', icon: 'width_normal', description: 'A slim centred column' },
|
|
59
|
+
{ value: 'contained', label: 'Contained', icon: 'width_wide', description: 'Centred at a comfortable width' },
|
|
60
|
+
{ value: 'full', label: 'Full width', icon: 'width_full', description: 'The whole column, edge to edge' },
|
|
61
|
+
];
|
|
62
|
+
|
|
44
63
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
64
|
+
* The theme is the `data-brand` attribute on <html> (none for the base
|
|
65
|
+
* look). Watched, so a pick made anywhere shows here; store it where you
|
|
66
|
+
* keep the reader's other preferences to make it last.
|
|
48
67
|
*/
|
|
49
|
-
const
|
|
68
|
+
const subscribeRoot = (callback: () => void) => {
|
|
69
|
+
const observer = new MutationObserver(callback);
|
|
70
|
+
observer.observe(document.documentElement, { attributes: true, attributeFilter: ['data-brand', 'data-theme'] });
|
|
71
|
+
return () => observer.disconnect();
|
|
72
|
+
};
|
|
73
|
+
const readBrand = () => document.documentElement.getAttribute('data-brand');
|
|
74
|
+
const readDark = () => document.documentElement.getAttribute('data-theme') === 'dark';
|
|
75
|
+
const applyBrand = (brand: string | null) => {
|
|
76
|
+
if (brand) document.documentElement.setAttribute('data-brand', brand);
|
|
77
|
+
else document.documentElement.removeAttribute('data-brand');
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/** Below the mobile step every mode gives way to the plain page, so Layout and Width leave the sidebar. */
|
|
81
|
+
const PHONE_QUERY = mediaBelow(BREAKPOINT_MOBILE_PX);
|
|
82
|
+
const subscribePhone = (callback: () => void) => {
|
|
83
|
+
const query = window.matchMedia(PHONE_QUERY);
|
|
84
|
+
query.addEventListener('change', callback);
|
|
85
|
+
return () => query.removeEventListener('change', callback);
|
|
86
|
+
};
|
|
87
|
+
const readPhone = () => window.matchMedia(PHONE_QUERY).matches;
|
|
88
|
+
|
|
89
|
+
/** How wide the page runs, apart from the mode. */
|
|
90
|
+
type ContentWidth = 'narrow' | 'contained' | 'full';
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* How wide the page runs, apart from the mode: `narrow` centres a slim
|
|
94
|
+
* column (960px), `contained` centres the content column (1440px), both set
|
|
95
|
+
* in AppShell.module.css, and `full` runs it the whole width the mode
|
|
96
|
+
* leaves. Any mode takes any of them.
|
|
97
|
+
*/
|
|
98
|
+
const CONTENT_WIDTH: ContentWidth = 'contained';
|
|
50
99
|
|
|
51
100
|
/** The product's name, shown beside the logo in the sidebar. */
|
|
52
101
|
const PRODUCT_NAME = 'Acme';
|
|
@@ -72,6 +121,64 @@ const NAV_SECTIONS: AppSidebarSection[] = [
|
|
|
72
121
|
},
|
|
73
122
|
];
|
|
74
123
|
|
|
124
|
+
/**
|
|
125
|
+
* The settings page's sections, which open in the sidebar's side panel from
|
|
126
|
+
* the Settings row, grouped as the page groups them. The settings block's
|
|
127
|
+
* page (app/settings/Settings.tsx) follows the hash each one links to.
|
|
128
|
+
*/
|
|
129
|
+
export const SETTINGS_SECTIONS = [
|
|
130
|
+
{ id: 'general', label: 'General', group: 'Workspace', description: 'How your workspace appears to everyone in it.' },
|
|
131
|
+
{ id: 'notifications', label: 'Notifications', group: 'Workspace', description: 'What we email you about. Each switch saves as it flips.' },
|
|
132
|
+
{ id: 'profile', label: 'Profile', group: 'Account', description: 'How you appear to the people you work with.' },
|
|
133
|
+
{ id: 'security', label: 'Security', group: 'Account', description: 'How you sign in, and where you are signed in now.' },
|
|
134
|
+
] as const;
|
|
135
|
+
|
|
136
|
+
/** The navigation, with the settings sections linked from wherever the reader is. */
|
|
137
|
+
function navFor(activeKey: string): AppSidebarSection[] {
|
|
138
|
+
// On the settings page a section is a jump within it; anywhere else it
|
|
139
|
+
// opens the settings page at that section.
|
|
140
|
+
const base = activeKey === 'settings' ? '' : ROUTES.settings;
|
|
141
|
+
return NAV_SECTIONS.map((section) => ({
|
|
142
|
+
...section,
|
|
143
|
+
items: section.items.map((item) =>
|
|
144
|
+
item.key === 'settings'
|
|
145
|
+
? {
|
|
146
|
+
...item,
|
|
147
|
+
children: SETTINGS_SECTIONS.map((entry) => ({
|
|
148
|
+
key: entry.id,
|
|
149
|
+
label: entry.label,
|
|
150
|
+
group: entry.group,
|
|
151
|
+
href: `${base}#${entry.id}`,
|
|
152
|
+
// A router's link (Next.js's) moves a hash without the
|
|
153
|
+
// hashchange event the settings page follows, so on that page
|
|
154
|
+
// the link sets the hash itself.
|
|
155
|
+
...(base === '' ? { onClick: () => window.location.assign(`#${entry.id}`) } : {}),
|
|
156
|
+
})),
|
|
157
|
+
}
|
|
158
|
+
: item,
|
|
159
|
+
),
|
|
160
|
+
}));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Where the toolbar's links go: the notifications and settings blocks'
|
|
165
|
+
* pages. Relative, so they resolve beside the page they are on: every block
|
|
166
|
+
* is a top-level route in your app (`notifications` from /dashboard is
|
|
167
|
+
* /notifications), and the rift-ds docs preview finds its own copies the
|
|
168
|
+
* same way. Make them absolute ('/notifications') if your pages nest.
|
|
169
|
+
*/
|
|
170
|
+
const ROUTES = { notifications: 'notifications', settings: 'settings' };
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The bell's latest notifications. Read your own; See all opens the
|
|
174
|
+
* notifications block's page at /notifications.
|
|
175
|
+
*/
|
|
176
|
+
const LATEST = [
|
|
177
|
+
{ id: 'payment', icon: 'payments', title: 'Payment received', text: 'Northwind Supply paid invoice 1042.', time: '2m' },
|
|
178
|
+
{ id: 'approval', icon: 'approval', title: 'Approval needed', text: 'Jordan Reyes asked to spend $1,632.42.', time: '1h' },
|
|
179
|
+
{ id: 'statement', icon: 'description', title: 'Statement ready', text: 'Your October statement is ready.', time: 'Mon' },
|
|
180
|
+
];
|
|
181
|
+
|
|
75
182
|
const PROFILE: AppSidebarProfile = {
|
|
76
183
|
name: 'Alex Morgan',
|
|
77
184
|
email: 'alex@example.com',
|
|
@@ -82,73 +189,156 @@ export interface AppShellProps {
|
|
|
82
189
|
activeKey: string;
|
|
83
190
|
/** The page's place in the app, ending with the page itself. */
|
|
84
191
|
breadcrumb?: BreadcrumbItem[];
|
|
192
|
+
/** The sub-item for this page, such as the open settings section. */
|
|
193
|
+
activeSubKey?: string;
|
|
85
194
|
/** The page title, the one h1. */
|
|
86
195
|
title: string;
|
|
196
|
+
/** A sentence under the title. */
|
|
197
|
+
description?: string;
|
|
87
198
|
/** Compact buttons at the end of the page header. */
|
|
88
199
|
actions?: ReactNode;
|
|
89
200
|
/** The page content. */
|
|
90
201
|
children: ReactNode;
|
|
91
202
|
}
|
|
92
203
|
|
|
93
|
-
export function AppShell({ activeKey, breadcrumb, title, actions, children }: AppShellProps) {
|
|
94
|
-
const [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
204
|
+
export function AppShell({ activeKey, activeSubKey, breadcrumb, title, description, actions, children }: AppShellProps) {
|
|
205
|
+
const [layout, setLayout] = useState<AppSidebarLayout>(SHELL_LAYOUT);
|
|
206
|
+
const [width, setWidth] = useState<ContentWidth>(CONTENT_WIDTH);
|
|
207
|
+
const [mode, setMode] = useColorMode();
|
|
208
|
+
const phone = useSyncExternalStore(subscribePhone, readPhone, () => false);
|
|
209
|
+
const brand = useSyncExternalStore(subscribeRoot, readBrand, () => null);
|
|
210
|
+
const dark = useSyncExternalStore(subscribeRoot, readDark, () => false);
|
|
211
|
+
const [unread, setUnread] = useState<string[]>(['payment', 'approval']);
|
|
212
|
+
|
|
213
|
+
// The sidebar's Appearance section: each row shows its current choice and
|
|
214
|
+
// opens the choices in the sidebar's panel, where a pick applies at once.
|
|
215
|
+
// Theme and Mode are the reader's (Mode is stored, like ThemeToggle's);
|
|
216
|
+
// Layout and Width are for trying the shell out, so pick yours and drop
|
|
217
|
+
// them.
|
|
218
|
+
const modeNow = MODES.find((option) => option.value === mode) ?? MODES[0];
|
|
219
|
+
const themes = shippedThemeOptions(dark ? 'dark' : 'light');
|
|
220
|
+
const themeNow = SHIPPED_THEMES.find((theme) => theme.brand === brand) ?? SHIPPED_THEMES[0];
|
|
221
|
+
const swatch = (color?: string) => <span className={styles.swatch} style={{ backgroundColor: color }} />;
|
|
222
|
+
const layoutNow = LAYOUTS.find((option) => option.value === layout) ?? LAYOUTS[0];
|
|
223
|
+
const widthNow = WIDTHS.find((option) => option.value === width) ?? WIDTHS[0];
|
|
224
|
+
const appearance: AppSidebarSection = {
|
|
225
|
+
category: 'Appearance',
|
|
226
|
+
items: [
|
|
227
|
+
{
|
|
228
|
+
key: 'appearance-theme',
|
|
229
|
+
label: 'Theme',
|
|
230
|
+
icon: swatch(themes.find((theme) => theme.value === themeNow.id)?.color),
|
|
231
|
+
value: themeNow.label,
|
|
232
|
+
children: SHIPPED_THEMES.map((theme) => ({
|
|
233
|
+
key: `theme-${theme.id}`,
|
|
234
|
+
label: theme.label,
|
|
235
|
+
icon: swatch(themes.find((option) => option.value === theme.id)?.color),
|
|
236
|
+
selected: theme.id === themeNow.id,
|
|
237
|
+
onClick: () => applyBrand(theme.brand),
|
|
238
|
+
})),
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
key: 'appearance-mode',
|
|
242
|
+
label: 'Mode',
|
|
243
|
+
icon: modeNow.icon,
|
|
244
|
+
value: modeNow.label,
|
|
245
|
+
children: MODES.map((option) => ({
|
|
246
|
+
key: `mode-${option.value}`,
|
|
247
|
+
label: option.label,
|
|
248
|
+
description: option.description,
|
|
249
|
+
icon: option.icon,
|
|
250
|
+
selected: option.value === mode,
|
|
251
|
+
onClick: () => setMode(option.value),
|
|
252
|
+
})),
|
|
253
|
+
},
|
|
254
|
+
...(phone
|
|
255
|
+
? []
|
|
256
|
+
: [
|
|
257
|
+
{
|
|
258
|
+
key: 'appearance-layout',
|
|
259
|
+
label: 'Layout',
|
|
260
|
+
icon: layoutNow.icon,
|
|
261
|
+
value: layoutNow.label,
|
|
262
|
+
children: LAYOUTS.map((option) => ({
|
|
263
|
+
key: `layout-${option.value}`,
|
|
264
|
+
label: option.label,
|
|
265
|
+
description: option.description,
|
|
266
|
+
icon: option.icon,
|
|
267
|
+
selected: option.value === layout,
|
|
268
|
+
onClick: () => setLayout(option.value),
|
|
269
|
+
})),
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
key: 'appearance-width',
|
|
273
|
+
label: 'Width',
|
|
274
|
+
icon: widthNow.icon,
|
|
275
|
+
value: widthNow.label,
|
|
276
|
+
children: WIDTHS.map((option) => ({
|
|
277
|
+
key: `width-${option.value}`,
|
|
278
|
+
label: option.label,
|
|
279
|
+
description: option.description,
|
|
280
|
+
icon: option.icon,
|
|
281
|
+
selected: option.value === width,
|
|
282
|
+
onClick: () => setWidth(option.value),
|
|
283
|
+
})),
|
|
284
|
+
},
|
|
285
|
+
]),
|
|
286
|
+
],
|
|
287
|
+
};
|
|
107
288
|
|
|
108
289
|
return (
|
|
109
|
-
<
|
|
290
|
+
<AppLayout
|
|
110
291
|
className={styles.shell}
|
|
111
|
-
|
|
112
|
-
|
|
292
|
+
theme="inherit"
|
|
293
|
+
sections={[...navFor(activeKey), appearance]}
|
|
294
|
+
profile={PROFILE}
|
|
295
|
+
activeKey={activeKey}
|
|
296
|
+
activeSubKey={activeSubKey}
|
|
297
|
+
logoText={PRODUCT_NAME}
|
|
298
|
+
layout={layout}
|
|
299
|
+
// AppLayout's width axis is contained or full; narrow is a contained
|
|
300
|
+
// column held slimmer, through data-width and AppShell.module.css.
|
|
301
|
+
width={width === 'full' ? 'full' : 'contained'}
|
|
302
|
+
data-width={width}
|
|
303
|
+
toolbar={
|
|
304
|
+
<AppToolbar
|
|
305
|
+
onSearch={() => {}}
|
|
306
|
+
actions={[
|
|
307
|
+
{
|
|
308
|
+
id: 'notifications',
|
|
309
|
+
icon: 'notifications',
|
|
310
|
+
label: 'Notifications',
|
|
311
|
+
badge: unread.length > 0 ? unread.length : undefined,
|
|
312
|
+
panel: (
|
|
313
|
+
<NotificationCenter
|
|
314
|
+
unreadCount={unread.length}
|
|
315
|
+
onMarkAllRead={() => setUnread([])}
|
|
316
|
+
seeAllHref={ROUTES.notifications}
|
|
317
|
+
>
|
|
318
|
+
{LATEST.map((item) => (
|
|
319
|
+
<NotificationItem
|
|
320
|
+
key={item.id}
|
|
321
|
+
media={item.icon}
|
|
322
|
+
title={item.title}
|
|
323
|
+
time={item.time}
|
|
324
|
+
unread={unread.includes(item.id)}
|
|
325
|
+
onSelect={() => setUnread((ids) => ids.filter((id) => id !== item.id))}
|
|
326
|
+
>
|
|
327
|
+
{item.text}
|
|
328
|
+
</NotificationItem>
|
|
329
|
+
))}
|
|
330
|
+
</NotificationCenter>
|
|
331
|
+
),
|
|
332
|
+
},
|
|
333
|
+
{ id: 'help', icon: 'help', label: 'Help' },
|
|
334
|
+
{ id: 'settings', icon: 'settings', label: 'Settings', href: ROUTES.settings },
|
|
335
|
+
]}
|
|
336
|
+
onChat={() => {}}
|
|
337
|
+
/>
|
|
338
|
+
}
|
|
113
339
|
>
|
|
114
|
-
<
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
activeKey={activeKey}
|
|
118
|
-
expanded={expanded}
|
|
119
|
-
onExpandedChange={setExpanded}
|
|
120
|
-
logoText={PRODUCT_NAME}
|
|
121
|
-
layout={SHELL_LAYOUT}
|
|
122
|
-
/>
|
|
123
|
-
|
|
124
|
-
<div className={styles.main}>
|
|
125
|
-
<div className={styles.surface}>
|
|
126
|
-
<div className={styles.content}>
|
|
127
|
-
<div ref={markerRef} className={styles.topBarMarker} aria-hidden="true" />
|
|
128
|
-
<header className={styles.topBar} data-stuck={stuck ? '' : undefined}>
|
|
129
|
-
<ProgressiveBlur className={styles.topBarBlur} tinted={stuck} />
|
|
130
|
-
{/* Wire both to your command palette: CommandPalette from
|
|
131
|
-
rift-ds, opened from here and from Cmd+K. */}
|
|
132
|
-
<CommandPaletteTrigger className={styles.search} />
|
|
133
|
-
<div className={styles.topBarActions}>
|
|
134
|
-
<CommandPaletteTrigger iconOnly className={styles.searchIcon} />
|
|
135
|
-
{/* The AI entry. Point both at your chat: `npx rift-ds init chat`
|
|
136
|
-
scaffolds one, and ChatLauncher opens it. On a phone the
|
|
137
|
-
labelled button gives way to the icon, as search does, so
|
|
138
|
-
the bar keeps room for the actions you add. */}
|
|
139
|
-
<AiButton className={styles.ai} />
|
|
140
|
-
<AiButton iconOnly className={styles.aiIcon} />
|
|
141
|
-
<ThemeToggle showLabels={false} />
|
|
142
|
-
</div>
|
|
143
|
-
</header>
|
|
144
|
-
|
|
145
|
-
<main className={styles.page}>
|
|
146
|
-
<PageHeader className={styles.pageHead} breadcrumb={breadcrumb} title={title} actions={actions} />
|
|
147
|
-
{children}
|
|
148
|
-
</main>
|
|
149
|
-
</div>
|
|
150
|
-
</div>
|
|
151
|
-
</div>
|
|
152
|
-
</div>
|
|
340
|
+
<PageHeader breadcrumb={breadcrumb} title={title} description={description} actions={actions} />
|
|
341
|
+
{children}
|
|
342
|
+
</AppLayout>
|
|
153
343
|
);
|
|
154
344
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
{
|
|
5
5
|
"name": "app-shell",
|
|
6
6
|
"label": "App shell",
|
|
7
|
-
"description": "A sidebar in your pick of the three shell modes, a top bar with search,
|
|
7
|
+
"description": "A sidebar in your pick of the three shell modes, a top bar with search, notifications, settings and AI, a page header, and an empty page with the spacing set.",
|
|
8
8
|
"route": "/starter",
|
|
9
9
|
"files": [
|
|
10
10
|
"components/blocks/AppShell.tsx",
|
|
@@ -28,14 +28,27 @@
|
|
|
28
28
|
{
|
|
29
29
|
"name": "settings",
|
|
30
30
|
"label": "Settings",
|
|
31
|
-
"description": "
|
|
31
|
+
"description": "A standard page per settings section, opened from the sidebar’s side panel: rows of a label, its help, the value and an Edit that changes it in place.",
|
|
32
32
|
"route": "/settings",
|
|
33
33
|
"files": [
|
|
34
34
|
"components/blocks/AppShell.tsx",
|
|
35
35
|
"components/blocks/AppShell.module.css",
|
|
36
36
|
"app/settings/page.tsx",
|
|
37
37
|
"app/settings/page.module.css",
|
|
38
|
-
"app/settings/
|
|
38
|
+
"app/settings/Settings.tsx"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "notifications",
|
|
43
|
+
"label": "Notifications",
|
|
44
|
+
"description": "The full list a notification panel’s See all opens: All and Unread tabs, a category filter, and rows by day, each read on open and cleared on its own.",
|
|
45
|
+
"route": "/notifications",
|
|
46
|
+
"files": [
|
|
47
|
+
"components/blocks/AppShell.tsx",
|
|
48
|
+
"components/blocks/AppShell.module.css",
|
|
49
|
+
"app/notifications/page.tsx",
|
|
50
|
+
"app/notifications/page.module.css",
|
|
51
|
+
"app/notifications/Inbox.tsx"
|
|
39
52
|
]
|
|
40
53
|
},
|
|
41
54
|
{
|
package/chat/ChatThreads.d.ts
CHANGED
|
@@ -1,45 +1,89 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { AppSidebarProps, AppSidebarSection } from '../components/AppSidebar/AppSidebar';
|
|
3
|
+
import { DrillMenuEntry } from '../components/DrillMenu/DrillMenu';
|
|
2
4
|
import { ThreadPanelProfile, ThreadPanelProps } from '../components/ThreadPanel/ThreadPanel';
|
|
3
5
|
export interface ChatThreadsProps {
|
|
4
|
-
/**
|
|
6
|
+
/** Set when a custom `threads` slot seats this rail in the widget's slide-over sheet, where it draws itself expanded; the built-in rail takes its form from the widget. */
|
|
5
7
|
overlay: boolean;
|
|
6
|
-
/** Closes
|
|
8
|
+
/** Closes that sheet; a no-op elsewhere. */
|
|
7
9
|
close: () => void;
|
|
8
|
-
/** The brand row's mark
|
|
10
|
+
/** The brand row's mark. Defaults to a generated pixel avatar seeded by `logoText`. */
|
|
9
11
|
logo?: ReactNode;
|
|
10
|
-
/** The brand row's text
|
|
12
|
+
/** The brand row's text, beside the mark while the rail is expanded. */
|
|
11
13
|
logoText?: string;
|
|
12
|
-
/** The signed-in person, shown
|
|
14
|
+
/** The signed-in person, shown at the rail's foot. */
|
|
13
15
|
profile?: ThreadPanelProfile;
|
|
14
|
-
/** Rendered in the rail's footer
|
|
16
|
+
/** Rendered in the rail's footer above the profile row: a theme toggle, a link out. Fades out while the rail is collapsed. */
|
|
15
17
|
footerSlot?: ReactNode;
|
|
16
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Let the reader fold the projects, each labelled history group and the
|
|
20
|
+
* host's `sections` under their headings. Every section starts open.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
collapsibleSections?: boolean;
|
|
24
|
+
/** Controlled list of folded sections: `projects`, then each group or section by `id` (else its heading). */
|
|
25
|
+
collapsedSections?: string[];
|
|
26
|
+
/** Sections folded at first (uncontrolled), keyed as `collapsedSections` is. */
|
|
27
|
+
defaultCollapsedSections?: string[];
|
|
28
|
+
/** Fires with the new list of folded sections. */
|
|
29
|
+
onCollapsedSectionsChange?: (collapsedSections: string[]) => void;
|
|
30
|
+
/** Rendered below the profile row, such as a full-width Button back to an index. It fades out while the rail is collapsed. */
|
|
31
|
+
footerAction?: ReactNode;
|
|
32
|
+
/** Rendered in the rail's footer while it is collapsed, in `footerSlot`'s place: the same controls at their smallest, stacked on the rail's axis, crossfading with the full form. */
|
|
17
33
|
collapsedFooterSlot?: ReactNode;
|
|
18
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* The host's own sections after the history, in AppSidebar's shape: a
|
|
36
|
+
* section of setting rows (Appearance) whose choices open in the side
|
|
37
|
+
* panel beside the rail and drill in on the drawer, as the app rail's do.
|
|
38
|
+
*/
|
|
39
|
+
sections?: AppSidebarSection[];
|
|
40
|
+
/** Rows above the sections in the drawer, in DrillMenu's shape, such as a workspace switcher that drills into its choices. */
|
|
41
|
+
drawerTopEntries?: DrillMenuEntry[];
|
|
42
|
+
/** Rows after the sections in the drawer, in DrillMenu's shape. */
|
|
43
|
+
drawerBottomEntries?: DrillMenuEntry[];
|
|
44
|
+
/**
|
|
45
|
+
* Whether the rail can collapse to its icon strip.
|
|
46
|
+
* @default true
|
|
47
|
+
*/
|
|
19
48
|
collapsible?: boolean;
|
|
20
49
|
/**
|
|
21
|
-
* Whether the
|
|
22
|
-
* collapsed to its icon strip. The
|
|
50
|
+
* Whether the rail starts expanded. Defaults to `false`: it starts
|
|
51
|
+
* collapsed to its icon strip. The drawer, and a rail that is not
|
|
23
52
|
* `collapsible`, always show expanded.
|
|
24
53
|
*/
|
|
25
54
|
defaultExpanded?: boolean;
|
|
26
|
-
/** Accessible
|
|
55
|
+
/** Accessible name of the history inside the rail. */
|
|
27
56
|
historyLabel?: string;
|
|
57
|
+
/** Accessible name of the rail's navigation landmark. */
|
|
58
|
+
railLabel?: string;
|
|
28
59
|
/**
|
|
29
|
-
* The words the
|
|
60
|
+
* The words the rail writes, merged over their English defaults: the
|
|
30
61
|
* spoken pin and status text ("Pinned", "Working"…), each row's menu
|
|
31
62
|
* trigger ("Thread options"), the rename field ("Rename thread"), the
|
|
32
|
-
* projects
|
|
33
|
-
* collapse toggle ("Collapse the panel", "Expand the panel"
|
|
34
|
-
* own name is
|
|
63
|
+
* projects heading and its add button ("Projects", "New project"), and the
|
|
64
|
+
* collapse toggle ("Collapse the panel", "Expand the panel", which reach
|
|
65
|
+
* the rail; `railLabels` wins over them). The history's own name is
|
|
66
|
+
* `historyLabel`.
|
|
35
67
|
*/
|
|
36
68
|
threadPanelLabels?: Pick<ThreadPanelProps, 'statusLabels' | 'pinnedLabel' | 'threadMenuLabel' | 'renameLabel' | 'projectsLabel' | 'newProjectLabel' | 'collapseLabel' | 'expandLabel'>;
|
|
69
|
+
/**
|
|
70
|
+
* The words the rail's shell writes, merged over AppSidebar's English
|
|
71
|
+
* defaults: the collapse toggle, the drawer's close button ("Close
|
|
72
|
+
* navigation"), its menu and back rows ("Menu", "Back to …", "… overview")
|
|
73
|
+
* and the profile's more button ("Profile options").
|
|
74
|
+
*/
|
|
75
|
+
railLabels?: Pick<AppSidebarProps, 'collapseLabel' | 'expandLabel' | 'closeLabel' | 'menuLabel' | 'drawerBackLabel' | 'drawerOverviewLabel' | 'profileMoreLabel'>;
|
|
37
76
|
/** The rows of each thread's menu, by action; a key left out keeps its English. Defaults to "Pin", "Unpin", "Rename" and "Delete". */
|
|
38
77
|
actionLabels?: Partial<Record<'pin' | 'unpin' | 'rename' | 'delete', string>>;
|
|
39
78
|
}
|
|
40
79
|
/**
|
|
41
|
-
* The built-in session-history rail:
|
|
42
|
-
* thread lifecycle (`useThreads`)
|
|
43
|
-
*
|
|
80
|
+
* The built-in session-history rail: an AppSidebar over the provider's
|
|
81
|
+
* thread lifecycle (`useThreads`), so a chat's rail has the app rail's
|
|
82
|
+
* shell, sizes, side panel and drawer, and only its content is its own.
|
|
83
|
+
* New chat leads, the projects follow as a section with an add action, the
|
|
84
|
+
* history is a section's content (ThreadHistory, the rows ThreadPanel
|
|
85
|
+
* draws), and the host's `sections` come after. The widget seats it and
|
|
86
|
+
* says which form its room allows: the rail beside the conversation, or
|
|
87
|
+
* the drawer over the widget, opened from the header's menu button.
|
|
44
88
|
*/
|
|
45
|
-
export declare function ChatThreads({ overlay, close, logo, logoText, profile, footerSlot, collapsedFooterSlot, collapsible, defaultExpanded, historyLabel, threadPanelLabels, actionLabels, }: ChatThreadsProps): import("react").JSX.Element;
|
|
89
|
+
export declare function ChatThreads({ overlay, close, logo, logoText, profile, footerSlot, footerAction, collapsibleSections, collapsedSections: controlledCollapsedSections, defaultCollapsedSections, onCollapsedSectionsChange, collapsedFooterSlot, sections: hostSections, drawerTopEntries, drawerBottomEntries, collapsible, defaultExpanded, historyLabel, railLabel, threadPanelLabels, railLabels, actionLabels, }: ChatThreadsProps): import("react").JSX.Element;
|