rift-ds 1.42.0 → 1.43.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.
Files changed (53) hide show
  1. package/README.md +2 -2
  2. package/bin/rift-ds.mjs +1 -0
  3. package/bin/templates/blocks/app/dashboard/page.module.css +2 -2
  4. package/bin/templates/blocks/app/notifications/Inbox.tsx +13 -45
  5. package/bin/templates/blocks/app/notifications/page.module.css +5 -0
  6. package/bin/templates/blocks/app/planner/page.tsx +2 -2
  7. package/bin/templates/blocks/app/settings/Settings.tsx +4 -4
  8. package/bin/templates/blocks/components/blocks/AppShell.tsx +13 -18
  9. package/bin/templates/blocks/components/blocks/notifications.ts +77 -0
  10. package/bin/templates/blocks/registry.json +5 -0
  11. package/chat/ChatWidget.js +2 -1
  12. package/components/AppLayout/AppLayout.css +6 -0
  13. package/components/AppLayout/AppLayout.d.ts +4 -0
  14. package/components/AppLayout/AppLayout.js +5 -1
  15. package/components/AppSidebar/AppSidebar.css +4 -0
  16. package/components/AppSidebar/AppSidebar.js +2 -0
  17. package/components/AppToolbar/AppToolbar.d.ts +5 -2
  18. package/components/AppToolbar/AppToolbar.js +3 -1
  19. package/components/Chart/AreaChart.js +7 -1
  20. package/components/Chart/Chart.css +12 -0
  21. package/components/Chart/LineChart.js +7 -1
  22. package/components/Chart/RadarChart.js +2 -1
  23. package/components/Chart/ScatterChart.js +7 -1
  24. package/components/Chart/StackedBarChart.js +7 -1
  25. package/components/ChatMessage/ChatMessage.css +6 -0
  26. package/components/DataTable/DataTable.css +6 -0
  27. package/components/DataTable/DataTable.js +3 -2
  28. package/components/Dropdown/Dropdown.js +8 -0
  29. package/components/EventCalendar/EventCalendar.css +12 -0
  30. package/components/Input/Input.css +12 -0
  31. package/components/Inspector/Inspector.css +4 -1
  32. package/components/NotificationCenter/NotificationCenter.css +136 -27
  33. package/components/NotificationCenter/NotificationCenter.d.ts +67 -8
  34. package/components/NotificationCenter/NotificationCenter.js +97 -12
  35. package/components/Popover/Popover.css +3 -0
  36. package/components/Popover/Popover.d.ts +1 -1
  37. package/components/Popover/Popover.js +9 -1
  38. package/components/QuestionCard/QuestionCard.css +7 -4
  39. package/components/SegmentedControl/SegmentedControl.css +5 -0
  40. package/components/Stat/Stat.css +8 -0
  41. package/components/Table/Table.css +5 -0
  42. package/components/ThemeToggle/colorMode.d.ts +3 -3
  43. package/components/Toolbar/Toolbar.d.ts +6 -1
  44. package/components/Wizard/Wizard.d.ts +8 -3
  45. package/components/Wizard/Wizard.js +4 -1
  46. package/components/registry.json +11 -5
  47. package/components/registry.json.d.ts +11 -5
  48. package/components/registry.json.js +1 -1
  49. package/package.json +1 -1
  50. package/tokens/presets/zest.css +9 -11
  51. package/tokens/values.d.ts +10 -3
  52. package/tokens/values.js +11 -5
  53. package/tokens/values.json.js +1 -1
package/README.md CHANGED
@@ -103,8 +103,8 @@ import 'rift-ds/tokens/presets/presets.css';
103
103
  ```
104
104
 
105
105
  - **Dark mode**: `data-theme="dark"` on the root element; light is the default.
106
- - **Theme names**: a preset's id is its `data-brand` value and stylesheet name, and a theme shown under another name answers to that name in lowercase too (Signal, id `plum`, also applies as `data-brand="signal"` and `tokens/presets/signal.css`). `SHIPPED_THEMES` from `rift-ds/tokens/values` lists every theme with its name and attribute, and `shippedThemeOptions()` hands ThemePicker the same list with each theme's swatch. To apply a stored theme before first paint, pass `colorModeScript({ brandStorageKey })` the key you keep it under.
107
- - **Page colours**: the token stylesheet defines custom properties and styles no element, so paint the page once: set `background: var(--color-bg-page-primary)`, `color: var(--color-text-primary)` and `font-family: var(--font-family-primary)` on `body`. Without it a dark theme lands as dark components on a white page.
106
+ - **Theme names**: a preset's id is its `data-brand` value and stylesheet name, and a theme shown under another name answers to that name in lowercase too (Signal, id `plum`, also applies as `data-brand="signal"` and `tokens/presets/signal.css`). `SHIPPED_THEMES` from `rift-ds/tokens/values` lists every theme with its name and attribute, and `shippedThemeOptions()` hands ThemePicker the same list with each theme's swatch, corner and faces. To apply a stored theme before first paint, pass `colorModeScript({ brandStorageKey })` the key you keep it under.
107
+ - **Page colours**: the token stylesheet defines custom properties and styles no element, so paint the page once: set `background: var(--color-bg-page-primary)`, `color: var(--color-text-primary)` and `font-family: var(--font-family-primary)` on `body`. Without it a dark theme lands as dark components on a white page. `rift-ds/tokens/base.css`, imported after the tokens, does exactly that along with the reset the components are tuned against, so an app that imports it has nothing to paint.
108
108
  - **Your own brand**: every semantic token chains to a primitive, so overriding one primitive re-themes everything built on it. The [playground](https://rift-ds.com/playground) restyles the system live and copies out a complete, paste-ready override.
109
109
  - **One part of a shipped theme**: the token and theme stylesheets sit in cascade layers (`rift.tokens`, then `rift.preset`), so any rule of your own outranks them whatever its selector. A plain `:root { --font-family-primary: … }` keeps a preset's colours with your face, in light and dark alike. To set a default that a preset still replaces, declare it inside `@layer rift.tokens { … }`.
110
110
  - **Overriding component styles**: component styles sit in a third layer, `rift.components`, after the two token layers, so your own CSS outside a layer always beats them, whatever its selector and in whatever order your bundler loads the sheets. `className` is the supported hook: `.my-table { … }` on `<Table className="my-table" />` holds in development and production alike. That reaches your resets too: a bare `* { margin: 0 }` would strip the components' spacing, so put a reset inside `@layer rift.tokens { … }`, or import `tokens/base.css`, which is already there.
package/bin/rift-ds.mjs CHANGED
@@ -312,6 +312,7 @@ function initApp({ app, dryRun }) {
312
312
  console.log(`\nPick a shipped theme before the first screen: the base theme is a neutral starting point, not a look.`);
313
313
  console.log(`Import ${PACKAGE_NAME}/tokens/presets/<id>.css after tokens.css and set data-brand="<id>" on <html>.`);
314
314
  console.log(`Compare them at ${SITE_ORIGIN}/playground.`);
315
+ console.log(`A shipped theme brings its own faces: once you pick one, drop the font.css and riftFont lines above, or the app ships a font it never shows.`);
315
316
  console.log(`A project with a theme.css from the playground already has its look: skip this, and follow that file's own steps for the font.`);
316
317
  console.log(`\nThen add a first page: npx ${PACKAGE_NAME} init block dashboard (no name lists them).`);
317
318
  console.log(`Setup and theming: ${SITE_ORIGIN}/docs/get-started`);
@@ -1,6 +1,6 @@
1
1
  /* The dashboard's grid. Four stats across on a desktop, two from the
2
- laptop width down to a phone, where each stat drops its delta under its
3
- label once its tile is narrow (deltaPlacement="auto"); the two panels sit
2
+ laptop width down to a phone, each stat keeping its delta beside its
3
+ value (deltaPlacement="inline") so the row reads as one shape; the two panels sit
4
4
  side by side until the tablet width, then stack. */
5
5
 
6
6
  .stats {
@@ -2,10 +2,11 @@
2
2
 
3
3
  /**
4
4
  * The notifications block's inbox: the page header's actions, the filters
5
- * and the list share one record of what is read and what is left, so they
6
- * hold here together. Swap INBOX for your notifications, `read` for your
7
- * server's read state, and the `onSelect` of each row for where it should
8
- * take the reader.
5
+ * and the list share one record of what is read and what is left with the
6
+ * bell in the shell's toolbar (`useNotifications` in components/blocks/notifications.ts), so a
7
+ * count reads the same in both. Swap that record for your notifications and
8
+ * your server's read state, and the `onSelect` of each row for where it
9
+ * should take the reader.
9
10
  */
10
11
 
11
12
  import { useState } from 'react';
@@ -14,35 +15,10 @@ import { Dropdown } from 'rift-ds/components/Dropdown/Dropdown';
14
15
  import { EmptyState } from 'rift-ds/components/EmptyState/EmptyState';
15
16
  import { NotificationItem } from 'rift-ds/components/NotificationCenter/NotificationCenter';
16
17
  import { Tabs } from 'rift-ds/components/Tabs/Tabs';
17
- import { AppShell } from '../../components/blocks/AppShell';
18
+ import { AppShell, PRODUCT_NAME } from '../../components/blocks/AppShell';
19
+ import { useNotifications } from '../../components/blocks/notifications';
18
20
  import styles from './page.module.css';
19
21
 
20
- type Category = 'payments' | 'cards' | 'team' | 'approvals';
21
-
22
- interface Notification {
23
- id: string;
24
- /** Which day group the row sits under. */
25
- group: 'Today' | 'This week' | 'Earlier';
26
- category: Category;
27
- icon: string;
28
- title: string;
29
- text: string;
30
- /** When it happened, already written for the reader. */
31
- time: string;
32
- }
33
-
34
- const INBOX: Notification[] = [
35
- { id: 'n1', group: 'Today', category: 'payments', icon: 'payments', title: 'Payment received', text: 'Northwind Supply paid invoice 1042 for $4,180.00.', time: '2m' },
36
- { id: 'n2', group: 'Today', category: 'approvals', icon: 'approval', title: 'Approval needed', text: 'Jordan Reyes asked to spend $1,632.42 from the Software budget.', time: '1h' },
37
- { id: 'n3', group: 'Today', category: 'cards', icon: 'credit_card_off', title: 'Card frozen', text: 'The card ending in 7781 is frozen until you unfreeze it.', time: '3h' },
38
- { id: 'n4', group: 'This week', category: 'team', icon: 'person_add', title: 'Invite accepted', text: 'Sam Patel joined Acme as an admin.', time: 'Tue' },
39
- { id: 'n5', group: 'This week', category: 'payments', icon: 'schedule', title: 'Payment scheduled', text: '$5,000.00 to Bright Studio goes out on Friday.', time: 'Mon' },
40
- { id: 'n6', group: 'This week', category: 'approvals', icon: 'receipt_long', title: 'Receipt missing', text: 'Add a receipt for $375.87 at Harbor Bistro.', time: 'Mon' },
41
- { id: 'n7', group: 'Earlier', category: 'cards', icon: 'credit_card', title: 'New card requested', text: 'Lee Chen asked for a card with a $5,000 limit.', time: 'Nov 18' },
42
- { id: 'n8', group: 'Earlier', category: 'team', icon: 'shield_person', title: 'Two admins required', text: 'Sensitive changes now need a second admin to approve.', time: 'Nov 14' },
43
- { id: 'n9', group: 'Earlier', category: 'payments', icon: 'description', title: 'Statement ready', text: 'Your October statement is ready to download.', time: 'Nov 1' },
44
- ];
45
-
46
22
  const GROUPS = ['Today', 'This week', 'Earlier'] as const;
47
23
 
48
24
  const CATEGORY_OPTIONS = [
@@ -54,17 +30,10 @@ const CATEGORY_OPTIONS = [
54
30
  ];
55
31
 
56
32
  export function Inbox() {
57
- const [items, setItems] = useState(INBOX);
58
- const [unread, setUnread] = useState<string[]>(['n1', 'n2', 'n3', 'n4']);
33
+ const { items, unread, read, readAll, dismiss, clear } = useNotifications();
59
34
  const [show, setShow] = useState('all');
60
35
  const [category, setCategory] = useState('all');
61
36
 
62
- const read = (id: string) => setUnread((ids) => ids.filter((other) => other !== id));
63
- const dismiss = (id: string) => {
64
- setItems((list) => list.filter((item) => item.id !== id));
65
- read(id);
66
- };
67
-
68
37
  const shown = items.filter(
69
38
  (item) =>
70
39
  (show === 'all' || unread.includes(item.id)) && (category === 'all' || item.category === category),
@@ -73,26 +42,25 @@ export function Inbox() {
73
42
  return (
74
43
  <AppShell
75
44
  activeKey="inbox"
76
- breadcrumb={[{ label: 'Acme', href: '#' }, { label: 'Notifications' }]}
45
+ breadcrumb={[{ label: PRODUCT_NAME, href: '#' }, { label: 'Notifications' }]}
77
46
  title="Notifications"
78
47
  actions={
79
48
  <>
80
49
  <Button
81
50
  label="Mark all as read"
82
51
  variant="secondary"
52
+ size="compact"
83
53
  iconLeft="done_all"
84
54
  disabled={unread.length === 0}
85
- onClick={() => setUnread([])}
55
+ onClick={readAll}
86
56
  />
87
57
  <Button
88
58
  label="Clear all"
89
59
  variant="tertiary"
60
+ size="compact"
90
61
  tone="destructive"
91
62
  disabled={items.length === 0}
92
- onClick={() => {
93
- setItems([]);
94
- setUnread([]);
95
- }}
63
+ onClick={clear}
96
64
  />
97
65
  </>
98
66
  }
@@ -56,6 +56,11 @@
56
56
  border-top: var(--border-025) solid var(--color-divider);
57
57
  }
58
58
 
59
+ /* A ruled row is square: a rule drawn on a curved corner bows at both ends. */
60
+ .list > :global(.ds-notification-item) {
61
+ border-radius: 0;
62
+ }
63
+
59
64
  @media (max-width: 480px) {
60
65
  .category {
61
66
  width: 100%;
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { Button } from 'rift-ds/components/Button/Button';
10
10
  import { Widget } from 'rift-ds/components/Widget/Widget';
11
- import { AppShell } from '../../components/blocks/AppShell';
11
+ import { AppShell, PRODUCT_NAME } from '../../components/blocks/AppShell';
12
12
  import { PlannerGrid } from './PlannerGrid';
13
13
  import { Requests } from './Requests';
14
14
  import styles from './page.module.css';
@@ -17,7 +17,7 @@ export default function PlannerPage() {
17
17
  return (
18
18
  <AppShell
19
19
  activeKey="projects"
20
- breadcrumb={[{ label: 'Acme', href: '#' }, { label: 'Planner' }]}
20
+ breadcrumb={[{ label: PRODUCT_NAME, href: '#' }, { label: 'Planner' }]}
21
21
  title="Planner"
22
22
  actions={<Button label="Add a row" variant="secondary" iconLeft="add" />}
23
23
  >
@@ -36,7 +36,7 @@ import { RadioGroup } from 'rift-ds/components/RadioButton/RadioButton';
36
36
  import { SegmentedControl } from 'rift-ds/components/SegmentedControl/SegmentedControl';
37
37
  import { Slider } from 'rift-ds/components/Slider/Slider';
38
38
  import { ToggleSwitch } from 'rift-ds/components/ToggleSwitch/ToggleSwitch';
39
- import { AppShell, SETTINGS_SECTIONS } from '../../components/blocks/AppShell';
39
+ import { AppShell, PRODUCT_NAME, SETTINGS_SECTIONS } from '../../components/blocks/AppShell';
40
40
  import styles from './page.module.css';
41
41
 
42
42
  type SectionId = (typeof SETTINGS_SECTIONS)[number]['id'];
@@ -69,7 +69,7 @@ const HOURS = ['18:00', '20:00', '22:00', '06:00', '08:00'].map((hour) => ({ val
69
69
  type FieldKey = 'workspaceName' | 'workspaceUrl' | 'name' | 'email' | 'phone' | 'password';
70
70
 
71
71
  const INITIAL: Record<FieldKey, string> = {
72
- workspaceName: 'Acme',
72
+ workspaceName: PRODUCT_NAME,
73
73
  workspaceUrl: 'acme',
74
74
  name: 'Alex Morgan',
75
75
  email: 'alex@example.com',
@@ -297,7 +297,7 @@ export function Settings() {
297
297
  <AppShell
298
298
  activeKey="settings"
299
299
  activeSubKey={active}
300
- breadcrumb={[{ label: 'Acme', href: '#' }, { label: 'Settings', href: '#general' }, { label: section.label }]}
300
+ breadcrumb={[{ label: PRODUCT_NAME, href: '#' }, { label: 'Settings', href: '#general' }, { label: section.label }]}
301
301
  title={section.label}
302
302
  description={section.description}
303
303
  >
@@ -362,7 +362,7 @@ export function Settings() {
362
362
  <Row
363
363
  label="Delete this workspace"
364
364
  description="Removes the workspace and everything in it for every member. This cannot be undone."
365
- control={<Button size="compact" variant="primary" tone="destructive" label="Delete workspace" />}
365
+ control={<Button size="compact" variant="secondary" tone="destructive" label="Delete workspace" />}
366
366
  />
367
367
  </Group>
368
368
  </>
@@ -14,11 +14,11 @@
14
14
  * scrolls, moves the page over while the sidebar's panel is open, sets the
15
15
  * content in a raised surface in the inset mode, and on a phone turns the
16
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.
17
+ * its own width: the AI entry to its icon, then the search. Help stays in the
18
+ * bar, since a More menu would hold it alone.
19
19
  */
20
20
 
21
- import { useState, type ReactNode } from 'react';
21
+ import type { ReactNode } from 'react';
22
22
  import { AppLayout } from 'rift-ds/components/AppLayout/AppLayout';
23
23
  import type { AppSidebarLayout, AppSidebarProfile, AppSidebarSection } from 'rift-ds/components/AppSidebar/AppSidebar';
24
24
  import { AppToolbar } from 'rift-ds/components/AppToolbar/AppToolbar';
@@ -27,6 +27,7 @@ import { NotificationCenter, NotificationItem } from 'rift-ds/components/Notific
27
27
  import { PageHeader } from 'rift-ds/components/PageHeader/PageHeader';
28
28
  import { useColorMode } from 'rift-ds/components/ThemeToggle/useColorMode';
29
29
  import { useLinkComponent } from 'rift-ds/behaviors/LinkProvider';
30
+ import { useNotifications } from './notifications';
30
31
  import styles from './AppShell.module.css';
31
32
 
32
33
  /**
@@ -59,8 +60,8 @@ type ContentWidth = 'narrow' | 'contained' | 'full';
59
60
  */
60
61
  const CONTENT_WIDTH: ContentWidth = 'contained';
61
62
 
62
- /** The product's name, shown beside the logo in the sidebar. */
63
- const PRODUCT_NAME = 'Acme';
63
+ /** The product's name: beside the logo in the sidebar, and wherever a page names it (import it there). */
64
+ export const PRODUCT_NAME = 'Acme';
64
65
 
65
66
  /** The sidebar's navigation. Give an item an `href` (`'/dashboard'`) to make it a link. */
66
67
  const NAV_SECTIONS: AppSidebarSection[] = [
@@ -138,15 +139,8 @@ function navFor(activeKey: string): AppSidebarSection[] {
138
139
  */
139
140
  const ROUTES = { notifications: 'notifications', settings: 'settings' };
140
141
 
141
- /**
142
- * The bell's latest notifications. Read your own; See all opens the
143
- * notifications block's page at /notifications.
144
- */
145
- const LATEST = [
146
- { id: 'payment', icon: 'payments', title: 'Payment received', text: 'Northwind Supply paid invoice 1042.', time: '2m' },
147
- { id: 'approval', icon: 'approval', title: 'Approval needed', text: 'Jordan Reyes asked to spend $1,632.42.', time: '1h' },
148
- { id: 'statement', icon: 'description', title: 'Statement ready', text: 'Your October statement is ready.', time: 'Mon' },
149
- ];
142
+ /** How many of the newest notifications the bell's panel lists. */
143
+ const BELL_ROWS = 3;
150
144
 
151
145
  const PROFILE: AppSidebarProfile = {
152
146
  name: 'Alex Morgan',
@@ -172,7 +166,8 @@ export interface AppShellProps {
172
166
 
173
167
  export function AppShell({ activeKey, activeSubKey, breadcrumb, title, description, actions, children }: AppShellProps) {
174
168
  const [mode, setMode] = useColorMode();
175
- const [unread, setUnread] = useState<string[]>(['payment', 'approval']);
169
+ const notifications = useNotifications();
170
+ const { unread } = notifications;
176
171
  // PageHeader renders on the server too, so it takes its link as a prop
177
172
  // rather than reading the provider: hand it the app's router link here,
178
173
  // or every breadcrumb click reloads the page.
@@ -231,17 +226,17 @@ export function AppShell({ activeKey, activeSubKey, breadcrumb, title, descripti
231
226
  panel: (
232
227
  <NotificationCenter
233
228
  unreadCount={unread.length}
234
- onMarkAllRead={() => setUnread([])}
229
+ onMarkAllRead={notifications.readAll}
235
230
  seeAllHref={ROUTES.notifications}
236
231
  >
237
- {LATEST.map((item) => (
232
+ {notifications.items.slice(0, BELL_ROWS).map((item) => (
238
233
  <NotificationItem
239
234
  key={item.id}
240
235
  media={item.icon}
241
236
  title={item.title}
242
237
  time={item.time}
243
238
  unread={unread.includes(item.id)}
244
- onSelect={() => setUnread((ids) => ids.filter((id) => id !== item.id))}
239
+ onSelect={() => notifications.read(item.id)}
245
240
  >
246
241
  {item.text}
247
242
  </NotificationItem>
@@ -0,0 +1,77 @@
1
+ 'use client';
2
+
3
+ /**
4
+ * The one record of the app's notifications and which are unread. The bell
5
+ * in the shell's toolbar (AppShell.tsx) and the notifications block's page
6
+ * (app/notifications/Inbox.tsx) both read it, so a count is the same
7
+ * wherever it shows and "Mark all as read" on the page clears the bell. It
8
+ * lives in memory for the visit. This file is yours: swap it for your own
9
+ * notifications and your server's read state, behind the same
10
+ * `useNotifications`.
11
+ */
12
+
13
+ import { useSyncExternalStore } from 'react';
14
+
15
+ /** One notification, as the bell and the notifications page both show it. */
16
+ export interface AppNotification {
17
+ id: string;
18
+ /** Which day group the row sits under on the notifications page. */
19
+ group: 'Today' | 'This week' | 'Earlier';
20
+ category: 'payments' | 'cards' | 'team' | 'approvals';
21
+ icon: string;
22
+ title: string;
23
+ text: string;
24
+ /** When it happened, already written for the reader. */
25
+ time: string;
26
+ }
27
+
28
+ const NOTIFICATIONS: AppNotification[] = [
29
+ { id: 'n1', group: 'Today', category: 'payments', icon: 'payments', title: 'Payment received', text: 'Northwind Supply paid invoice 1042 for $4,180.00.', time: '2m' },
30
+ { id: 'n2', group: 'Today', category: 'approvals', icon: 'approval', title: 'Approval needed', text: 'Jordan Reyes asked to spend $1,632.42 from the Software budget.', time: '1h' },
31
+ { id: 'n3', group: 'Today', category: 'cards', icon: 'credit_card_off', title: 'Card frozen', text: 'The card ending in 7781 is frozen until you unfreeze it.', time: '3h' },
32
+ { id: 'n4', group: 'This week', category: 'team', icon: 'person_add', title: 'Invite accepted', text: 'Sam Patel joined the workspace as an admin.', time: 'Tue' },
33
+ { id: 'n5', group: 'This week', category: 'payments', icon: 'schedule', title: 'Payment scheduled', text: '$5,000.00 to Bright Studio goes out on Friday.', time: 'Mon' },
34
+ { id: 'n6', group: 'This week', category: 'approvals', icon: 'receipt_long', title: 'Receipt missing', text: 'Add a receipt for $375.87 at Harbor Bistro.', time: 'Mon' },
35
+ { id: 'n7', group: 'Earlier', category: 'cards', icon: 'credit_card', title: 'New card requested', text: 'Lee Chen asked for a card with a $5,000 limit.', time: 'Nov 18' },
36
+ { id: 'n8', group: 'Earlier', category: 'team', icon: 'shield_person', title: 'Two admins required', text: 'Sensitive changes now need a second admin to approve.', time: 'Nov 14' },
37
+ { id: 'n9', group: 'Earlier', category: 'payments', icon: 'description', title: 'Statement ready', text: 'Your October statement is ready to download.', time: 'Nov 1' },
38
+ ];
39
+
40
+ // The record itself, held in memory for the visit.
41
+ let inbox: { items: AppNotification[]; unread: string[] } = {
42
+ items: NOTIFICATIONS,
43
+ unread: ['n1', 'n2', 'n3', 'n4'],
44
+ };
45
+ const inboxListeners = new Set<() => void>();
46
+ const subscribeInbox = (listener: () => void) => {
47
+ inboxListeners.add(listener);
48
+ return () => {
49
+ inboxListeners.delete(listener);
50
+ };
51
+ };
52
+ const readInbox = () => inbox;
53
+ function writeInbox(next: typeof inbox) {
54
+ inbox = next;
55
+ inboxListeners.forEach((listener) => listener());
56
+ }
57
+
58
+ /** The notifications, which are unread, and the four things a reader does to them. */
59
+ export function useNotifications() {
60
+ const { items, unread } = useSyncExternalStore(subscribeInbox, readInbox, readInbox);
61
+ return {
62
+ items,
63
+ unread,
64
+ /** Marks one as read. */
65
+ read: (id: string) => writeInbox({ items: inbox.items, unread: inbox.unread.filter((other) => other !== id) }),
66
+ /** Marks every one as read. */
67
+ readAll: () => writeInbox({ items: inbox.items, unread: [] }),
68
+ /** Clears one from the list. */
69
+ dismiss: (id: string) =>
70
+ writeInbox({
71
+ items: inbox.items.filter((item) => item.id !== id),
72
+ unread: inbox.unread.filter((other) => other !== id),
73
+ }),
74
+ /** Clears the whole list. */
75
+ clear: () => writeInbox({ items: [], unread: [] }),
76
+ };
77
+ }
@@ -9,6 +9,7 @@
9
9
  "files": [
10
10
  "components/blocks/AppShell.tsx",
11
11
  "components/blocks/AppShell.module.css",
12
+ "components/blocks/notifications.ts",
12
13
  "app/starter/page.tsx",
13
14
  "app/starter/page.module.css",
14
15
  "app/settings/page.tsx",
@@ -27,6 +28,7 @@
27
28
  "files": [
28
29
  "components/blocks/AppShell.tsx",
29
30
  "components/blocks/AppShell.module.css",
31
+ "components/blocks/notifications.ts",
30
32
  "app/dashboard/page.tsx",
31
33
  "app/dashboard/page.module.css",
32
34
  "app/settings/page.tsx",
@@ -45,6 +47,7 @@
45
47
  "files": [
46
48
  "components/blocks/AppShell.tsx",
47
49
  "components/blocks/AppShell.module.css",
50
+ "components/blocks/notifications.ts",
48
51
  "app/settings/page.tsx",
49
52
  "app/settings/page.module.css",
50
53
  "app/settings/Settings.tsx",
@@ -61,6 +64,7 @@
61
64
  "files": [
62
65
  "components/blocks/AppShell.tsx",
63
66
  "components/blocks/AppShell.module.css",
67
+ "components/blocks/notifications.ts",
64
68
  "app/notifications/page.tsx",
65
69
  "app/notifications/page.module.css",
66
70
  "app/notifications/Inbox.tsx",
@@ -77,6 +81,7 @@
77
81
  "files": [
78
82
  "components/blocks/AppShell.tsx",
79
83
  "components/blocks/AppShell.module.css",
84
+ "components/blocks/notifications.ts",
80
85
  "app/planner/page.tsx",
81
86
  "app/planner/page.module.css",
82
87
  "app/planner/PlannerGrid.tsx",
@@ -396,6 +396,7 @@ function ChatWidget({
396
396
  }, [artifacts, turns, openArtifact]);
397
397
  const trailingUp = artifactInline || Boolean(renderAside) && asideOpen && asideWide;
398
398
  const threadsInline = threadsWide && !(trailingUp && !asideRoomy);
399
+ const railNamesChat = builtInThreads && threadsInline && (threadsProps?.logoText ?? title) === title;
399
400
  useEffect(() => {
400
401
  if (!artifacts) return;
401
402
  const host = railsHostRef.current;
@@ -628,7 +629,7 @@ function ChatWidget({
628
629
  }
629
630
  ),
630
631
  typeof logo === "string" ? /* @__PURE__ */ jsx("img", { src: logo, alt: "", width: 20, height: 20 }) : logo,
631
- /* @__PURE__ */ jsx("span", { className: "ds-chat-widget__brand-name", children: title })
632
+ !railNamesChat && /* @__PURE__ */ jsx("span", { className: "ds-chat-widget__brand-name", children: title })
632
633
  ] }),
633
634
  actions: (
634
635
  /* With the agent rail seated inline the cluster moves to the
@@ -20,6 +20,12 @@
20
20
  /* ============================================
21
21
  MAIN CONTENT AREA
22
22
  ============================================ */
23
+ /* The skip link lands here: the region takes the focus without a ring of
24
+ its own around the whole page. */
25
+ .ds-app-layout__main:focus {
26
+ outline: none;
27
+ }
28
+
23
29
  .ds-app-layout__main {
24
30
  flex: 1;
25
31
  display: flex;
@@ -79,6 +79,10 @@ type AppLayoutOwnProps = {
79
79
  * component and the rail's seat) are its own.
80
80
  */
81
81
  sidebarProps?: AppLayoutSidebarProps;
82
+ /** The id of the main region, the skip link's target. */
83
+ mainId?: string;
84
+ /** The skip link's text, the page's first stop, which jumps past the sidebar and toolbar to the content. Pass an empty string for none. */
85
+ skipLinkLabel?: string;
82
86
  /** Additional CSS classes on outer wrapper */
83
87
  className?: string;
84
88
  };
@@ -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 { Link } from "../Link/Link.js";
6
7
  import "../../behaviors/shell.css";
7
8
  import "./AppLayout.css";
8
9
  const AppLayout = React.forwardRef(
@@ -23,6 +24,8 @@ const AppLayout = React.forwardRef(
23
24
  theme = "dark",
24
25
  linkComponent,
25
26
  sidebarProps,
27
+ mainId = "main",
28
+ skipLinkLabel = "Skip to content",
26
29
  className = "",
27
30
  ...rest
28
31
  }, ref) => {
@@ -61,6 +64,7 @@ const AppLayout = React.forwardRef(
61
64
  "data-ds-shell": layout,
62
65
  "data-ds-width": width,
63
66
  children: [
67
+ skipLinkLabel && /* @__PURE__ */ jsx(Link, { variant: "skip", href: `#${mainId}`, children: skipLinkLabel }),
64
68
  /* @__PURE__ */ jsx(
65
69
  AppSidebar,
66
70
  {
@@ -79,7 +83,7 @@ const AppLayout = React.forwardRef(
79
83
  linkComponent
80
84
  }
81
85
  ),
82
- /* @__PURE__ */ jsx("main", { className: `${baseClass}__main`, children: layout === "inset" ? (
86
+ /* @__PURE__ */ jsx("main", { id: mainId, className: `${baseClass}__main`, tabIndex: -1, children: layout === "inset" ? (
83
87
  // The surface clips to its rounded corners and the scroller
84
88
  // inside it scrolls, so the scrollbar never squares a corner.
85
89
  /* @__PURE__ */ jsx("div", { className: `${baseClass}__surface`, children: /* @__PURE__ */ jsx("div", { className: `${baseClass}__scroller`, onScroll: handleSurfaceScroll, children: content }) })
@@ -180,6 +180,9 @@
180
180
  align-items: center;
181
181
  gap: var(--gap-500);
182
182
  min-width: 0;
183
+ /* In the rail the logo is the button that opens the sidebar, and its
184
+ focus ring follows the round controls beside it. */
185
+ border-radius: var(--radius-pill);
183
186
  }
184
187
 
185
188
  .ds-app-sidebar__logo-icon {
@@ -1422,6 +1425,7 @@
1422
1425
  /* The rail's standalone controls (the collapse toggle, the profile menu
1423
1426
  button, the mobile trigger) take the same ring, outside their round box as
1424
1427
  Button's sits, rather than the browser's default. */
1428
+ .ds-app-sidebar__logo-inner:focus-visible,
1425
1429
  .ds-app-sidebar__toggle:focus-visible,
1426
1430
  .ds-app-sidebar__profile-more:focus-visible,
1427
1431
  .ds-app-sidebar__mobile-trigger:focus-visible {
@@ -509,6 +509,8 @@ const AppSidebar = React.forwardRef(function AppSidebar2({
509
509
  className: `${baseClass}__toggle`,
510
510
  onClick: mobileOpen ? closeMobile : toggleExpanded,
511
511
  "aria-label": toggleLabel,
512
+ tabIndex: isExpanded || mobileOpen ? void 0 : -1,
513
+ "aria-hidden": isExpanded || mobileOpen ? void 0 : true,
512
514
  children: /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded ds-mirror-rtl", children: mobileOpen ? "close" : isExpanded ? "left_panel_close" : "left_panel_open" })
513
515
  }
514
516
  ) })
@@ -42,7 +42,9 @@ type AppToolbarOwnProps = {
42
42
  /**
43
43
  * Opens the app's search, usually a CommandPalette. When given, the bar
44
44
  * starts with a search field, never narrower than a usable field, folded
45
- * to its icon when the bar is narrow.
45
+ * to its icon when the bar is narrow. The field is a CommandPaletteTrigger
46
+ * the bar draws itself: pass this handler rather than seating a trigger
47
+ * of your own beside the bar, which the bar cannot fold.
46
48
  */
47
49
  onSearch?: React.MouseEventHandler<HTMLButtonElement>;
48
50
  /** The search field's prompt and accessible name. Default "Search or ask anything". */
@@ -62,7 +64,8 @@ type AppToolbarOwnProps = {
62
64
  /**
63
65
  * The icon controls at the end, borderless: notifications, a calendar,
64
66
  * help, settings. On a narrow bar every one after the first moves into a
65
- * More menu, except those that open a panel or are links.
67
+ * More menu, except those that open a panel or are links, and except
68
+ * when only one could move, which stays in the bar.
66
69
  */
67
70
  actions?: AppToolbarAction[];
68
71
  /**
@@ -27,7 +27,9 @@ function AppToolbar({
27
27
  ...rest
28
28
  }) {
29
29
  const baseClass = "ds-app-toolbar";
30
- const folds = (action, index) => index > 0 && !action.panel && !action.href;
30
+ const canFold = (action, index) => index > 0 && !action.panel && !action.href;
31
+ const foldsAny = actions.filter(canFold).length > 1;
32
+ const folds = (action, index) => foldsAny && canFold(action, index);
31
33
  const foldable = actions.filter(folds);
32
34
  const moreItems = foldable.map((action) => ({
33
35
  id: action.id,
@@ -129,7 +129,13 @@ const AreaChart = React.forwardRef(({
129
129
  },
130
130
  s.dataKey
131
131
  )),
132
- showLegend && series.length > 1 && /* @__PURE__ */ jsx(Legend, { wrapperStyle: { color: textSecondary, fontSize: textSize } })
132
+ showLegend && series.length > 1 && /* @__PURE__ */ jsx(
133
+ Legend,
134
+ {
135
+ wrapperStyle: { color: textSecondary, fontSize: textSize },
136
+ formatter: (value) => /* @__PURE__ */ jsx("span", { style: { color: textSecondary }, children: value })
137
+ }
138
+ )
133
139
  ] }) })
134
140
  ] })
135
141
  ]
@@ -357,4 +357,16 @@
357
357
  }
358
358
  }
359
359
 
360
+ /* ============================================
361
+ FOCUS — the drawing is a tab stop (the arrow
362
+ keys move the tooltip), so it takes the
363
+ system ring, not the browser's.
364
+ ============================================ */
365
+
366
+ .ds-chart .recharts-surface:focus-visible {
367
+ outline: 2px solid var(--color-action-primary-bg);
368
+ outline-offset: 2px;
369
+ border-radius: var(--radius-100);
370
+ }
371
+
360
372
  } /* @layer rift.components */
@@ -135,7 +135,13 @@ const LineChart = React.forwardRef(({
135
135
  },
136
136
  s.dataKey
137
137
  )),
138
- showLegend && series.length > 1 && /* @__PURE__ */ jsx(Legend, { wrapperStyle: { color: textSecondary, fontSize: textSize } })
138
+ showLegend && series.length > 1 && /* @__PURE__ */ jsx(
139
+ Legend,
140
+ {
141
+ wrapperStyle: { color: textSecondary, fontSize: textSize },
142
+ formatter: (value) => /* @__PURE__ */ jsx("span", { style: { color: textSecondary }, children: value })
143
+ }
144
+ )
139
145
  ] }) })
140
146
  ] })
141
147
  ]
@@ -126,7 +126,8 @@ const RadarChart = React.forwardRef(({
126
126
  series.length > 1 && /* @__PURE__ */ jsx(
127
127
  Legend,
128
128
  {
129
- wrapperStyle: { color: textSecondary, fontSize: textSize }
129
+ wrapperStyle: { color: textSecondary, fontSize: textSize },
130
+ formatter: (value) => /* @__PURE__ */ jsx("span", { style: { color: textSecondary }, children: value })
130
131
  }
131
132
  )
132
133
  ] }) })
@@ -126,7 +126,13 @@ const ScatterChart = React.forwardRef(({
126
126
  },
127
127
  ds.name
128
128
  )),
129
- datasets.length > 1 && /* @__PURE__ */ jsx(Legend, { wrapperStyle: { color: textSecondary, fontSize: textSize } })
129
+ datasets.length > 1 && /* @__PURE__ */ jsx(
130
+ Legend,
131
+ {
132
+ wrapperStyle: { color: textSecondary, fontSize: textSize },
133
+ formatter: (value) => /* @__PURE__ */ jsx("span", { style: { color: textSecondary }, children: value })
134
+ }
135
+ )
130
136
  ] }) })
131
137
  ] })
132
138
  ]