rift-ds 1.41.0 → 1.42.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 (187) hide show
  1. package/behaviors/LoadingImage.d.ts +2 -0
  2. package/behaviors/LoadingImage.js +34 -0
  3. package/behaviors/ScrollRegion.js +15 -2
  4. package/behaviors/VisuallyHidden.d.ts +30 -0
  5. package/behaviors/VisuallyHidden.js +17 -0
  6. package/behaviors/loading-image.css +30 -0
  7. package/behaviors/quietFocus.d.ts +4 -0
  8. package/behaviors/quietFocus.js +14 -0
  9. package/behaviors/useFocusScope.d.ts +3 -1
  10. package/behaviors/useFocusScope.js +4 -6
  11. package/bin/rift-ds.mjs +1 -0
  12. package/bin/templates/app/components/rift/ColorModeScript.tsx +3 -1
  13. package/bin/templates/app/components/rift/RiftRoot.tsx +40 -1
  14. package/bin/templates/blocks/app/dashboard/page.tsx +7 -5
  15. package/bin/templates/blocks/app/landing/page.tsx +1 -1
  16. package/bin/templates/blocks/app/pricing/page.module.css +15 -1
  17. package/bin/templates/blocks/app/pricing/page.tsx +8 -1
  18. package/bin/templates/blocks/app/sign-in/page.tsx +10 -2
  19. package/bin/templates/blocks/app/sign-up/page.module.css +83 -0
  20. package/bin/templates/blocks/app/sign-up/page.tsx +126 -0
  21. package/bin/templates/blocks/app/starter/page.tsx +1 -1
  22. package/bin/templates/blocks/components/blocks/AppShell.module.css +0 -10
  23. package/bin/templates/blocks/components/blocks/AppShell.tsx +39 -115
  24. package/bin/templates/blocks/components/blocks/DocsShell.tsx +5 -1
  25. package/bin/templates/blocks/registry.json +44 -6
  26. package/components/AgentPlan/AgentPlan.css +1 -1
  27. package/components/AlertDialog/AlertDialog.css +14 -0
  28. package/components/AlertDialog/AlertDialog.d.ts +35 -3
  29. package/components/AlertDialog/AlertDialog.js +16 -5
  30. package/components/AppSidebar/AppSidebar.css +13 -2
  31. package/components/AppSidebar/AppSidebar.js +7 -2
  32. package/components/Attachment/AttachmentGroup.js +2 -1
  33. package/components/Attachment/AttachmentTile.js +2 -1
  34. package/components/Badge/Badge.css +6 -0
  35. package/components/Breadcrumb/Breadcrumb.css +4 -1
  36. package/components/Button/Button.css +20 -1
  37. package/components/Button/Button.js +6 -1
  38. package/components/Card/Card.css +11 -0
  39. package/components/Card/Card.d.ts +9 -3
  40. package/components/Card/Card.js +21 -2
  41. package/components/Chart/AreaChart.d.ts +7 -0
  42. package/components/Chart/AreaChart.js +51 -45
  43. package/components/Chart/BarChart.d.ts +7 -0
  44. package/components/Chart/BarChart.js +52 -46
  45. package/components/Chart/Chart.css +122 -1
  46. package/components/Chart/ChartSkeleton.d.ts +32 -0
  47. package/components/Chart/ChartSkeleton.js +149 -0
  48. package/components/Chart/ComboChart.d.ts +7 -0
  49. package/components/Chart/ComboChart.js +80 -74
  50. package/components/Chart/LineChart.d.ts +17 -3
  51. package/components/Chart/LineChart.js +61 -39
  52. package/components/Chart/PieChart.d.ts +7 -0
  53. package/components/Chart/PieChart.js +41 -34
  54. package/components/Chart/RadarChart.d.ts +7 -0
  55. package/components/Chart/RadarChart.js +38 -32
  56. package/components/Chart/RadialChart.d.ts +7 -0
  57. package/components/Chart/RadialChart.js +5 -1
  58. package/components/Chart/ScatterChart.d.ts +7 -0
  59. package/components/Chart/ScatterChart.js +46 -40
  60. package/components/Chart/StackedBarChart.d.ts +10 -1
  61. package/components/Chart/StackedBarChart.js +51 -43
  62. package/components/Chart/Treemap.d.ts +7 -0
  63. package/components/Chart/Treemap.js +17 -11
  64. package/components/Checkbox/Checkbox.css +25 -1
  65. package/components/Checkbox/Checkbox.d.ts +8 -4
  66. package/components/Checkbox/Checkbox.js +17 -8
  67. package/components/Chip/Chip.css +5 -3
  68. package/components/ContactCard/ContactCard.css +4 -3
  69. package/components/ContributionGraph/ContributionGraph.css +20 -0
  70. package/components/ContributionGraph/ContributionGraph.d.ts +4 -0
  71. package/components/ContributionGraph/ContributionGraph.js +11 -6
  72. package/components/DataTable/DataTable.css +28 -4
  73. package/components/DataTable/DataTable.d.ts +16 -2
  74. package/components/DataTable/DataTable.js +5 -0
  75. package/components/DateInput/DateInput.css +3 -1
  76. package/components/DatePicker/DatePicker.css +16 -0
  77. package/components/DatePicker/DatePicker.d.ts +13 -0
  78. package/components/DatePicker/DatePicker.js +21 -27
  79. package/components/DatePicker/MonthGrid.d.ts +2 -2
  80. package/components/DatePicker/MonthGrid.js +1 -1
  81. package/components/DatePicker/today.d.ts +15 -0
  82. package/components/DatePicker/today.js +17 -0
  83. package/components/DateRangePicker/DateRangePicker.d.ts +14 -1
  84. package/components/DateRangePicker/DateRangePicker.js +18 -7
  85. package/components/DescriptionList/DescriptionList.css +11 -0
  86. package/components/DescriptionList/DescriptionList.d.ts +5 -1
  87. package/components/DescriptionList/DescriptionList.js +21 -6
  88. package/components/Dialog/Dialog.css +9 -0
  89. package/components/Dialog/Dialog.d.ts +9 -0
  90. package/components/Dialog/Dialog.js +32 -19
  91. package/components/DocumentChip/DocumentChip.css +1 -1
  92. package/components/Drawer/Drawer.d.ts +9 -0
  93. package/components/Drawer/Drawer.js +8 -0
  94. package/components/Dropdown/Dropdown.css +3 -1
  95. package/components/EmptyState/EmptyState.css +8 -1
  96. package/components/Field/Field.css +2 -2
  97. package/components/FileInput/FileInput.css +1 -1
  98. package/components/FilterBar/FilterBar.d.ts +6 -1
  99. package/components/FunnelChart/FunnelChart.d.ts +7 -0
  100. package/components/FunnelChart/FunnelChart.js +44 -30
  101. package/components/GanttChart/GanttChart.css +10 -0
  102. package/components/GanttChart/GanttChart.d.ts +4 -0
  103. package/components/GanttChart/GanttChart.js +66 -33
  104. package/components/Gauge/Gauge.css +23 -0
  105. package/components/Gauge/Gauge.d.ts +4 -0
  106. package/components/Gauge/Gauge.js +14 -8
  107. package/components/ImageCompare/ImageCompare.js +2 -1
  108. package/components/Input/Input.css +3 -1
  109. package/components/List/List.css +1 -1
  110. package/components/NotificationCenter/NotificationCenter.css +16 -0
  111. package/components/NotificationCenter/NotificationCenter.d.ts +4 -0
  112. package/components/NotificationCenter/NotificationCenter.js +23 -1
  113. package/components/NumberInput/NumberInput.css +2 -0
  114. package/components/PageHeader/PageHeader.css +12 -4
  115. package/components/Panel/Panel.d.ts +1 -1
  116. package/components/Prose/Prose.css +1 -1
  117. package/components/RadioButton/RadioButton.css +1 -1
  118. package/components/RadioButton/RadioButton.d.ts +4 -2
  119. package/components/RadioButton/RadioButton.js +5 -2
  120. package/components/ResourceTimeline/ResourceTimeline.css +12 -0
  121. package/components/ResourceTimeline/ResourceTimeline.d.ts +5 -1
  122. package/components/ResourceTimeline/ResourceTimeline.js +94 -52
  123. package/components/RichDropdown/RichDropdown.css +3 -1
  124. package/components/SelectionCard/SelectionCard.css +29 -0
  125. package/components/SelectionCard/SelectionCard.d.ts +7 -0
  126. package/components/SelectionCard/SelectionCard.js +25 -2
  127. package/components/Sparkline/Sparkline.css +20 -0
  128. package/components/Sparkline/Sparkline.d.ts +4 -0
  129. package/components/Sparkline/Sparkline.js +14 -8
  130. package/components/Stat/Stat.css +31 -0
  131. package/components/Stat/Stat.d.ts +23 -2
  132. package/components/Stat/Stat.js +21 -6
  133. package/components/Table/Table.css +101 -16
  134. package/components/Table/Table.d.ts +4 -0
  135. package/components/Table/Table.js +43 -28
  136. package/components/Textarea/Textarea.css +4 -2
  137. package/components/ThemeToggle/colorMode.d.ts +10 -2
  138. package/components/ThemeToggle/colorMode.js +4 -2
  139. package/components/ThreadHistory/ThreadHistory.css +11 -0
  140. package/components/ThreadHistory/ThreadHistory.d.ts +5 -1
  141. package/components/ThreadHistory/ThreadHistory.js +6 -1
  142. package/components/ThreadPanel/ThreadPanel.d.ts +4 -0
  143. package/components/ThreadPanel/ThreadPanel.js +5 -1
  144. package/components/TimePicker/TimePicker.css +3 -1
  145. package/components/TimePicker/TimePicker.d.ts +4 -2
  146. package/components/TimePicker/TimePicker.js +11 -3
  147. package/components/Timeline/Timeline.css +15 -0
  148. package/components/Timeline/Timeline.d.ts +8 -0
  149. package/components/Timeline/Timeline.js +21 -0
  150. package/components/Toast/Toast.css +16 -0
  151. package/components/Toast/Toast.d.ts +7 -2
  152. package/components/ToggleGroup/ToggleGroup.css +28 -2
  153. package/components/ToggleSwitch/ToggleSwitch.css +1 -1
  154. package/components/Tooltip/Tooltip.d.ts +9 -0
  155. package/components/Tooltip/Tooltip.js +34 -8
  156. package/components/TreeView/TreeView.css +12 -0
  157. package/components/TreeView/TreeView.d.ts +4 -0
  158. package/components/TreeView/TreeView.js +20 -0
  159. package/components/UsageCard/UsageCard.css +11 -0
  160. package/components/UsageCard/UsageCard.d.ts +4 -0
  161. package/components/UsageCard/UsageCard.js +25 -16
  162. package/components/Widget/Widget.css +7 -0
  163. package/components/Widget/Widget.d.ts +4 -0
  164. package/components/Widget/Widget.js +14 -2
  165. package/components/registry.json +4 -1
  166. package/components/registry.json.d.ts +4 -1
  167. package/components/registry.json.js +1 -1
  168. package/package.json +7 -2
  169. package/tokens/presets/contrast.css +4 -4
  170. package/tokens/presets/coral.css +3 -4
  171. package/tokens/presets/forest.css +16 -4
  172. package/tokens/presets/gold.css +4 -3
  173. package/tokens/presets/marquee.css +2 -3
  174. package/tokens/presets/mono.css +28 -28
  175. package/tokens/presets/pink.css +5 -4
  176. package/tokens/presets/terminal.css +4 -3
  177. package/tokens/presets/violet.css +3 -4
  178. package/tokens/presets/warm.css +16 -4
  179. package/tokens/presets/zest.css +2 -2
  180. package/tokens/registry.json +1 -0
  181. package/tokens/registry.json.d.ts +1 -0
  182. package/tokens/registry.json.js +1 -1
  183. package/tokens/tokens-dark.css +4 -0
  184. package/tokens/tokens-light.css +4 -0
  185. package/tokens/values.d.ts +14 -1
  186. package/tokens/values.js +14 -1
  187. package/tokens/values.json.js +1 -1
@@ -3,8 +3,8 @@
3
3
  /**
4
4
  * The app shell every rift-ds app block page sits in, composed from the
5
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,
6
+ * app shell modes, SHELL_LAYOUT below, at the width CONTENT_WIDTH sets), an
7
+ * AppToolbar in AppLayout's toolbar slot (the search,
8
8
  * the notifications, help, settings and the AI entry), and a PageHeader
9
9
  * (breadcrumb, title, actions) over the page. This file is yours: rename the
10
10
  * product, change the navigation, and grow it with your app.
@@ -18,7 +18,7 @@
18
18
  * controls after the first into a More menu.
19
19
  */
20
20
 
21
- import { useState, useSyncExternalStore, type ReactNode } from 'react';
21
+ import { useState, 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';
@@ -26,10 +26,7 @@ import type { BreadcrumbItem } from 'rift-ds/components/Breadcrumb/Breadcrumb';
26
26
  import { NotificationCenter, NotificationItem } from 'rift-ds/components/NotificationCenter/NotificationCenter';
27
27
  import { PageHeader } from 'rift-ds/components/PageHeader/PageHeader';
28
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';
29
+ import { useLinkComponent } from 'rift-ds/behaviors/LinkProvider';
33
30
  import styles from './AppShell.module.css';
34
31
 
35
32
  /**
@@ -38,55 +35,19 @@ import styles from './AppShell.module.css';
38
35
  * hairline, the content crisp beside it; `floating` lifts the sidebar into a
39
36
  * card on the shell colour off the edges, the content crisp on the app
40
37
  * surface; `inset` runs it flush and sets the content in a
41
- * raised surface held off the other edges, scrolling inside itself.
38
+ * raised surface held off the other edges, scrolling inside itself. Pick
39
+ * one here: the shell carries no layout picker, since a product ships one
40
+ * shell, not a choice of three.
42
41
  */
43
42
  const SHELL_LAYOUT: AppSidebarLayout = 'floating';
44
43
 
45
- /** The sidebar's Appearance rows: what each choice is called and shows. */
44
+ /** The sidebar's Mode row: what each choice is called and shows. */
46
45
  const MODES = [
47
46
  { value: 'system', label: 'System', icon: 'routine', description: 'Follows your device' },
48
47
  { value: 'light', label: 'Light', icon: 'light_mode', description: 'Light surfaces, dark text' },
49
48
  { value: 'dark', label: 'Dark', icon: 'dark_mode', description: 'Dark surfaces, light text' },
50
49
  ] as const;
51
50
 
52
- const LAYOUTS: { value: AppSidebarLayout; label: string; icon: string; description: string }[] = [
53
- { value: 'flush', label: 'Flush', icon: 'vertical_split', description: 'Edge to edge behind a hairline' },
54
- { value: 'floating', label: 'Floating', icon: 'view_sidebar', description: 'The sidebar as a card beside the page' },
55
- { value: 'inset', label: 'Inset', icon: 'space_dashboard', description: 'The page in a raised surface' },
56
- ];
57
-
58
- const WIDTHS: { value: ContentWidth; label: string; icon: string; description: string }[] = [
59
- { value: 'narrow', label: 'Narrow', icon: 'width_normal', description: 'A slim centred column' },
60
- { value: 'contained', label: 'Contained', icon: 'width_wide', description: 'Centred at a comfortable width' },
61
- { value: 'full', label: 'Full width', icon: 'width_full', description: 'The whole column, edge to edge' },
62
- ];
63
-
64
- /**
65
- * The theme is the `data-brand` attribute on <html> (none for the base
66
- * look). Watched, so a pick made anywhere shows here; store it where you
67
- * keep the reader's other preferences to make it last.
68
- */
69
- const subscribeRoot = (callback: () => void) => {
70
- const observer = new MutationObserver(callback);
71
- observer.observe(document.documentElement, { attributes: true, attributeFilter: ['data-brand', 'data-theme'] });
72
- return () => observer.disconnect();
73
- };
74
- const readBrand = () => document.documentElement.getAttribute('data-brand');
75
- const readDark = () => document.documentElement.getAttribute('data-theme') === 'dark';
76
- const applyBrand = (brand: string | null) => {
77
- if (brand) document.documentElement.setAttribute('data-brand', brand);
78
- else document.documentElement.removeAttribute('data-brand');
79
- };
80
-
81
- /** Below the mobile step every mode gives way to the plain page, so Layout and Width leave the sidebar. */
82
- const PHONE_QUERY = mediaBelow(BREAKPOINT_MOBILE_PX);
83
- const subscribePhone = (callback: () => void) => {
84
- const query = window.matchMedia(PHONE_QUERY);
85
- query.addEventListener('change', callback);
86
- return () => query.removeEventListener('change', callback);
87
- };
88
- const readPhone = () => window.matchMedia(PHONE_QUERY).matches;
89
-
90
51
  /** How wide the page runs, apart from the mode. */
91
52
  type ContentWidth = 'narrow' | 'contained' | 'full';
92
53
 
@@ -94,7 +55,7 @@ type ContentWidth = 'narrow' | 'contained' | 'full';
94
55
  * How wide the page runs, apart from the mode: `narrow` centres a slim
95
56
  * column (960px), `contained` centres the content column (1440px), both set
96
57
  * in AppShell.module.css, and `full` runs it the whole width the mode
97
- * leaves. Any mode takes any of them.
58
+ * leaves. Any mode takes any of them. Set it here, as with the mode.
98
59
  */
99
60
  const CONTENT_WIDTH: ContentWidth = 'contained';
100
61
 
@@ -134,6 +95,12 @@ export const SETTINGS_SECTIONS = [
134
95
  { id: 'security', label: 'Security', group: 'Account', description: 'How you sign in, and where you are signed in now.' },
135
96
  ] as const;
136
97
 
98
+ /** Moves the page to a settings section's hash and tells whoever follows it. */
99
+ function openSection(id: string) {
100
+ window.history.pushState(null, '', `#${id}`);
101
+ window.dispatchEvent(new HashChangeEvent('hashchange'));
102
+ }
103
+
137
104
  /** The navigation, with the settings sections linked from wherever the reader is. */
138
105
  function navFor(activeKey: string): AppSidebarSection[] {
139
106
  // On the settings page a section is a jump within it; anywhere else it
@@ -152,8 +119,8 @@ function navFor(activeKey: string): AppSidebarSection[] {
152
119
  href: `${base}#${entry.id}`,
153
120
  // A router's link (Next.js's) moves a hash without the
154
121
  // hashchange event the settings page follows, so on that page
155
- // the link sets the hash itself.
156
- ...(base === '' ? { onClick: () => window.location.assign(`#${entry.id}`) } : {}),
122
+ // the link moves the hash and says so itself.
123
+ ...(base === '' ? { onClick: () => openSection(entry.id) } : {}),
157
124
  })),
158
125
  }
159
126
  : item,
@@ -163,7 +130,8 @@ function navFor(activeKey: string): AppSidebarSection[] {
163
130
 
164
131
  /**
165
132
  * Where the toolbar's links go: the notifications and settings blocks'
166
- * pages. Relative, so they resolve beside the page they are on: every block
133
+ * pages, which every block that writes this shell writes too, so both
134
+ * resolve from the first one you add. Relative, so they resolve beside the page they are on: every block
167
135
  * is a top-level route in your app (`notifications` from /dashboard is
168
136
  * /notifications), and the rift-ds docs preview finds its own copies the
169
137
  * same way. Make them absolute ('/notifications') if your pages nest.
@@ -203,41 +171,23 @@ export interface AppShellProps {
203
171
  }
204
172
 
205
173
  export function AppShell({ activeKey, activeSubKey, breadcrumb, title, description, actions, children }: AppShellProps) {
206
- const [layout, setLayout] = useState<AppSidebarLayout>(SHELL_LAYOUT);
207
- const [width, setWidth] = useState<ContentWidth>(CONTENT_WIDTH);
208
174
  const [mode, setMode] = useColorMode();
209
- const phone = useSyncExternalStore(subscribePhone, readPhone, () => false);
210
- const brand = useSyncExternalStore(subscribeRoot, readBrand, () => null);
211
- const dark = useSyncExternalStore(subscribeRoot, readDark, () => false);
212
175
  const [unread, setUnread] = useState<string[]>(['payment', 'approval']);
176
+ // PageHeader renders on the server too, so it takes its link as a prop
177
+ // rather than reading the provider: hand it the app's router link here,
178
+ // or every breadcrumb click reloads the page.
179
+ const linkComponent = useLinkComponent();
213
180
 
214
- // The sidebar's Appearance section: each row shows its current choice and
215
- // opens the choices in the sidebar's panel, where a pick applies at once.
216
- // Theme and Mode are the reader's (Mode is stored, like ThemeToggle's);
217
- // Layout and Width are for trying the shell out, so pick yours and drop
218
- // them.
181
+ // The reader's one appearance choice: the colour mode, stored like
182
+ // ThemeToggle's. The row shows the current choice and opens the three in
183
+ // the sidebar's panel, where a pick applies at once. The theme, the shell
184
+ // mode and the width are the product's decisions, made in code (the theme
185
+ // in the root layout, the other two above), so the shell offers no picker
186
+ // for them.
219
187
  const modeNow = MODES.find((option) => option.value === mode) ?? MODES[0];
220
- const themes = shippedThemeOptions(dark ? 'dark' : 'light');
221
- const themeNow = SHIPPED_THEMES.find((theme) => theme.brand === brand) ?? SHIPPED_THEMES[0];
222
- const swatch = (color?: string) => <span className={styles.swatch} style={{ backgroundColor: color }} />;
223
- const layoutNow = LAYOUTS.find((option) => option.value === layout) ?? LAYOUTS[0];
224
- const widthNow = WIDTHS.find((option) => option.value === width) ?? WIDTHS[0];
225
188
  const appearance: AppSidebarSection = {
226
189
  category: 'Appearance',
227
190
  items: [
228
- {
229
- key: 'appearance-theme',
230
- label: 'Theme',
231
- icon: swatch(themes.find((theme) => theme.value === themeNow.id)?.color),
232
- value: themeNow.label,
233
- children: SHIPPED_THEMES.map((theme) => ({
234
- key: `theme-${theme.id}`,
235
- label: theme.label,
236
- icon: swatch(themes.find((option) => option.value === theme.id)?.color),
237
- selected: theme.id === themeNow.id,
238
- onClick: () => applyBrand(theme.brand),
239
- })),
240
- },
241
191
  {
242
192
  key: 'appearance-mode',
243
193
  label: 'Mode',
@@ -252,38 +202,6 @@ export function AppShell({ activeKey, activeSubKey, breadcrumb, title, descripti
252
202
  onClick: () => setMode(option.value),
253
203
  })),
254
204
  },
255
- ...(phone
256
- ? []
257
- : [
258
- {
259
- key: 'appearance-layout',
260
- label: 'Layout',
261
- icon: layoutNow.icon,
262
- value: layoutNow.label,
263
- children: LAYOUTS.map((option) => ({
264
- key: `layout-${option.value}`,
265
- label: option.label,
266
- description: option.description,
267
- icon: option.icon,
268
- selected: option.value === layout,
269
- onClick: () => setLayout(option.value),
270
- })),
271
- },
272
- {
273
- key: 'appearance-width',
274
- label: 'Width',
275
- icon: widthNow.icon,
276
- value: widthNow.label,
277
- children: WIDTHS.map((option) => ({
278
- key: `width-${option.value}`,
279
- label: option.label,
280
- description: option.description,
281
- icon: option.icon,
282
- selected: option.value === width,
283
- onClick: () => setWidth(option.value),
284
- })),
285
- },
286
- ]),
287
205
  ],
288
206
  };
289
207
 
@@ -296,11 +214,11 @@ export function AppShell({ activeKey, activeSubKey, breadcrumb, title, descripti
296
214
  activeKey={activeKey}
297
215
  activeSubKey={activeSubKey}
298
216
  logoText={PRODUCT_NAME}
299
- layout={layout}
217
+ layout={SHELL_LAYOUT}
300
218
  // AppLayout's width axis is contained or full; narrow is a contained
301
219
  // column held slimmer, through data-width and AppShell.module.css.
302
- width={width === 'full' ? 'full' : 'contained'}
303
- data-width={width}
220
+ width={CONTENT_WIDTH === 'full' ? 'full' : 'contained'}
221
+ data-width={CONTENT_WIDTH}
304
222
  toolbar={
305
223
  <AppToolbar
306
224
  onSearch={() => {}}
@@ -338,7 +256,13 @@ export function AppShell({ activeKey, activeSubKey, breadcrumb, title, descripti
338
256
  />
339
257
  }
340
258
  >
341
- <PageHeader breadcrumb={breadcrumb} title={title} description={description} actions={actions} />
259
+ <PageHeader
260
+ breadcrumb={breadcrumb}
261
+ title={title}
262
+ description={description}
263
+ actions={actions}
264
+ linkComponent={linkComponent}
265
+ />
342
266
  {children}
343
267
  </AppLayout>
344
268
  );
@@ -20,6 +20,7 @@
20
20
  */
21
21
 
22
22
  import type { ReactNode } from 'react';
23
+ import { useLinkComponent } from 'rift-ds/behaviors/LinkProvider';
23
24
  import { AnchorNav } from 'rift-ds/components/AnchorNav/AnchorNav';
24
25
  import { BackToTop } from 'rift-ds/components/BackToTop/BackToTop';
25
26
  import { Breadcrumb, type BreadcrumbItem } from 'rift-ds/components/Breadcrumb/Breadcrumb';
@@ -123,6 +124,9 @@ export interface DocsShellProps {
123
124
  }
124
125
 
125
126
  export function DocsShell({ currentHref, breadcrumb, children }: DocsShellProps) {
127
+ // Breadcrumb renders on the server too, so it takes its link as a prop:
128
+ // hand it the app's router link, or a crumb reloads the page.
129
+ const linkComponent = useLinkComponent();
126
130
  return (
127
131
  <SiteLayout
128
132
  width={PAGE_WIDTH}
@@ -171,7 +175,7 @@ export function DocsShell({ currentHref, breadcrumb, children }: DocsShellProps)
171
175
  />
172
176
  }
173
177
  >
174
- <Breadcrumb items={breadcrumb} />
178
+ <Breadcrumb items={breadcrumb} linkComponent={linkComponent} />
175
179
  <div className={styles.article}>{children}</div>
176
180
  <BackToTop focusTarget="docs-article" />
177
181
  </SiteLayout>
@@ -1,5 +1,5 @@
1
1
  {
2
- "$comment": "The blocks: whole starting pages the init bin copies into a consumer's app, composed from the library alone. Each lists every file it writes, at its target path (app/** lands in the app router folder, components/** beside it). A file may belong to more than one block; init never overwrites, so the shared shell is written once. scripts/validate-blocks.mjs holds this file to the tree and the site's previews.",
2
+ "$comment": "The blocks: whole starting pages the init bin copies into a consumer's app, composed from the library alone. Each lists every file it writes, at its target path (app/** lands in the app router folder, components/** beside it). A file may belong to more than one block; init never overwrites, so the shared shell is written once. A block lists every page its own links reach, so nothing it writes points at a page that is not there: each app shell block carries the settings and notifications pages the shell's toolbar opens, and sign-in and sign-up carry each other. scripts/validate-blocks.mjs holds this file to the tree and the site's previews.",
3
3
  "blocks": [
4
4
  {
5
5
  "name": "app-shell",
@@ -10,7 +10,13 @@
10
10
  "components/blocks/AppShell.tsx",
11
11
  "components/blocks/AppShell.module.css",
12
12
  "app/starter/page.tsx",
13
- "app/starter/page.module.css"
13
+ "app/starter/page.module.css",
14
+ "app/settings/page.tsx",
15
+ "app/settings/page.module.css",
16
+ "app/settings/Settings.tsx",
17
+ "app/notifications/page.tsx",
18
+ "app/notifications/page.module.css",
19
+ "app/notifications/Inbox.tsx"
14
20
  ]
15
21
  },
16
22
  {
@@ -22,7 +28,13 @@
22
28
  "components/blocks/AppShell.tsx",
23
29
  "components/blocks/AppShell.module.css",
24
30
  "app/dashboard/page.tsx",
25
- "app/dashboard/page.module.css"
31
+ "app/dashboard/page.module.css",
32
+ "app/settings/page.tsx",
33
+ "app/settings/page.module.css",
34
+ "app/settings/Settings.tsx",
35
+ "app/notifications/page.tsx",
36
+ "app/notifications/page.module.css",
37
+ "app/notifications/Inbox.tsx"
26
38
  ]
27
39
  },
28
40
  {
@@ -35,7 +47,10 @@
35
47
  "components/blocks/AppShell.module.css",
36
48
  "app/settings/page.tsx",
37
49
  "app/settings/page.module.css",
38
- "app/settings/Settings.tsx"
50
+ "app/settings/Settings.tsx",
51
+ "app/notifications/page.tsx",
52
+ "app/notifications/page.module.css",
53
+ "app/notifications/Inbox.tsx"
39
54
  ]
40
55
  },
41
56
  {
@@ -48,7 +63,10 @@
48
63
  "components/blocks/AppShell.module.css",
49
64
  "app/notifications/page.tsx",
50
65
  "app/notifications/page.module.css",
51
- "app/notifications/Inbox.tsx"
66
+ "app/notifications/Inbox.tsx",
67
+ "app/settings/page.tsx",
68
+ "app/settings/page.module.css",
69
+ "app/settings/Settings.tsx"
52
70
  ]
53
71
  },
54
72
  {
@@ -62,7 +80,13 @@
62
80
  "app/planner/page.tsx",
63
81
  "app/planner/page.module.css",
64
82
  "app/planner/PlannerGrid.tsx",
65
- "app/planner/Requests.tsx"
83
+ "app/planner/Requests.tsx",
84
+ "app/settings/page.tsx",
85
+ "app/settings/page.module.css",
86
+ "app/settings/Settings.tsx",
87
+ "app/notifications/page.tsx",
88
+ "app/notifications/page.module.css",
89
+ "app/notifications/Inbox.tsx"
66
90
  ]
67
91
  },
68
92
  {
@@ -71,6 +95,20 @@
71
95
  "description": "A centred sign-in card with email and password, remember me and a single sign-on route.",
72
96
  "route": "/sign-in",
73
97
  "files": [
98
+ "app/sign-in/page.tsx",
99
+ "app/sign-in/page.module.css",
100
+ "app/sign-up/page.tsx",
101
+ "app/sign-up/page.module.css"
102
+ ]
103
+ },
104
+ {
105
+ "name": "sign-up",
106
+ "label": "Sign up",
107
+ "description": "The sign-in card for a new account: name, email and a new password, agreement to the terms and a single sign-on route.",
108
+ "route": "/sign-up",
109
+ "files": [
110
+ "app/sign-up/page.tsx",
111
+ "app/sign-up/page.module.css",
74
112
  "app/sign-in/page.tsx",
75
113
  "app/sign-in/page.module.css"
76
114
  ]
@@ -234,7 +234,7 @@
234
234
  }
235
235
 
236
236
  .ds-agent-plan__step--failed .ds-agent-plan__label {
237
- color: var(--color-status-error-text);
237
+ color: var(--color-text-error);
238
238
  }
239
239
 
240
240
  /* ============================================
@@ -114,6 +114,20 @@
114
114
  margin: 0;
115
115
  }
116
116
 
117
+ /* ============================================
118
+ BODY
119
+ What the decision needs between the words and
120
+ the actions: a confirm field, a checkbox. It
121
+ only stacks; the content brings its own type.
122
+ ============================================ */
123
+
124
+ .ds-alert-dialog__body {
125
+ display: flex;
126
+ flex-direction: column;
127
+ gap: var(--gap-300); /* 12px */
128
+ min-width: 0;
129
+ }
130
+
117
131
  /* ============================================
118
132
  ACTIONS
119
133
  ============================================ */
@@ -11,6 +11,12 @@ type AlertDialogOwnProps = {
11
11
  title: string;
12
12
  /** Dialog description / body text */
13
13
  description?: string;
14
+ /**
15
+ * Content between the description and the actions: a type-to-confirm
16
+ * field, a checkbox, a short list of what will be removed. Keep it to what
17
+ * the decision needs; a form of its own belongs in a Dialog.
18
+ */
19
+ children?: React.ReactNode;
14
20
  /** Confirm button label */
15
21
  confirmLabel?: string;
16
22
  /** Cancel button label */
@@ -19,6 +25,31 @@ type AlertDialogOwnProps = {
19
25
  onConfirm?: () => void;
20
26
  /** Callback when cancel is clicked */
21
27
  onCancel?: () => void;
28
+ /**
29
+ * Whether the confirm action is unavailable, for a decision that needs
30
+ * something first: the name typed into a confirm field, a box ticked.
31
+ */
32
+ confirmDisabled?: boolean;
33
+ /**
34
+ * Whether the confirmed action is in flight. The confirm button shows its
35
+ * spinner and takes no press, and Cancel, Escape and the backdrop are held
36
+ * until it finishes, so the dialog cannot close under the work. Pair it
37
+ * with `closeOnConfirm={false}`.
38
+ */
39
+ confirmLoading?: boolean;
40
+ /**
41
+ * Whether pressing confirm also asks the dialog to close. `true` (the
42
+ * default) calls `onConfirm` and then `onOpenChange(false)`. `false` calls
43
+ * `onConfirm` only, so the host keeps the dialog open while the action
44
+ * runs (`confirmLoading`) and closes it when the action settles.
45
+ */
46
+ closeOnConfirm?: boolean;
47
+ /**
48
+ * The element that takes focus when the dialog opens: a ref to a field
49
+ * inside it, such as a type-to-confirm input. Without one, focus lands on
50
+ * Cancel, the safe action.
51
+ */
52
+ initialFocus?: React.RefObject<HTMLElement | null>;
22
53
  /**
23
54
  * Colour of the dialog's icon, title and confirm action: `destructive`
24
55
  * for dangerous or irreversible actions.
@@ -33,13 +64,14 @@ type AlertDialogOwnProps = {
33
64
  /** Additional CSS classes on the overlay container (the ref and native attributes go on the panel) */
34
65
  className?: string;
35
66
  };
36
- export interface AlertDialogProps extends AlertDialogOwnProps, Omit<React.ComponentPropsWithoutRef<'div'>, keyof AlertDialogOwnProps | 'children' | 'role'> {
67
+ export interface AlertDialogProps extends AlertDialogOwnProps, Omit<React.ComponentPropsWithoutRef<'div'>, keyof AlertDialogOwnProps | 'role'> {
37
68
  }
38
69
  /**
39
70
  * AlertDialog component for important confirmations.
40
71
  * Renders a modal overlay with title, description,
41
- * and confirm / cancel actions. Traps focus and
42
- * supports ESC key dismissal.
72
+ * optional content the decision needs, and confirm /
73
+ * cancel actions. Traps focus and supports ESC key
74
+ * dismissal.
43
75
  */
44
76
  export declare const AlertDialog: React.ForwardRefExoticComponent<AlertDialogProps & React.RefAttributes<HTMLDivElement>>;
45
77
  export {};
@@ -14,10 +14,15 @@ const AlertDialog = React.forwardRef(({
14
14
  onOpenChange,
15
15
  title,
16
16
  description,
17
+ children,
17
18
  confirmLabel = "Confirm",
18
19
  cancelLabel = "Cancel",
19
20
  onConfirm,
20
21
  onCancel,
22
+ confirmDisabled = false,
23
+ confirmLoading = false,
24
+ closeOnConfirm = true,
25
+ initialFocus,
21
26
  tone,
22
27
  variant,
23
28
  className = "",
@@ -34,17 +39,19 @@ const AlertDialog = React.forwardRef(({
34
39
  const baseClass = "ds-alert-dialog";
35
40
  const mounted = useMounted();
36
41
  const handleCancel = useCallback(() => {
42
+ if (confirmLoading) return;
37
43
  onCancel?.();
38
44
  onOpenChange(false);
39
- }, [onCancel, onOpenChange]);
45
+ }, [confirmLoading, onCancel, onOpenChange]);
40
46
  const handleConfirm = useCallback(() => {
47
+ if (confirmDisabled || confirmLoading) return;
41
48
  onConfirm?.();
42
- onOpenChange(false);
43
- }, [onConfirm, onOpenChange]);
44
- const layer = useLayer({ open, onDismiss: handleCancel });
49
+ if (closeOnConfirm) onOpenChange(false);
50
+ }, [confirmDisabled, confirmLoading, closeOnConfirm, onConfirm, onOpenChange]);
51
+ const layer = useLayer({ open, dismissOnEscape: !confirmLoading, onDismiss: handleCancel });
45
52
  useFocusScope(panelRef, {
46
53
  active: open,
47
- initialFocus: () => panelRef.current?.querySelector(`.${baseClass}__actions button:first-child`) ?? null
54
+ initialFocus: () => initialFocus?.current ?? panelRef.current?.querySelector(`.${baseClass}__actions button:first-child`) ?? null
48
55
  });
49
56
  useScrollLock(open);
50
57
  const resolvedTone = tone ?? variant ?? "default";
@@ -85,12 +92,14 @@ const AlertDialog = React.forwardRef(({
85
92
  /* @__PURE__ */ jsx("h2", { className: `${baseClass}__title`, id: titleId, children: title })
86
93
  ] }),
87
94
  description && /* @__PURE__ */ jsx("p", { className: `${baseClass}__description`, id: descId, children: description }),
95
+ children != null && children !== false && /* @__PURE__ */ jsx("div", { className: `${baseClass}__body`, children }),
88
96
  /* @__PURE__ */ jsxs("div", { className: `${baseClass}__actions`, children: [
89
97
  /* @__PURE__ */ jsx(
90
98
  Button,
91
99
  {
92
100
  label: cancelLabel,
93
101
  variant: "tertiary",
102
+ disabled: confirmLoading,
94
103
  onClick: handleCancel
95
104
  }
96
105
  ),
@@ -100,6 +109,8 @@ const AlertDialog = React.forwardRef(({
100
109
  label: confirmLabel,
101
110
  variant: resolvedTone === "destructive" ? "secondary" : "primary",
102
111
  tone: resolvedTone,
112
+ disabled: confirmDisabled,
113
+ loading: confirmLoading,
103
114
  onClick: handleConfirm
104
115
  }
105
116
  )
@@ -31,8 +31,9 @@
31
31
  shell sets both; a rail standing alone takes the same look. */
32
32
  background-color: var(--ds-shell-rail-bg, var(--color-bg-app-shell));
33
33
  border-inline-end: var(--border-025) solid var(--ds-shell-rail-divider, var(--color-bg-container-border));
34
- /* The logo mark draws in currentColor; without a colour of its own the
35
- rail inherited the host's, and the mark vanished on a dark host. */
34
+ /* A logo a host passes may draw in currentColor; without a colour of its
35
+ own the rail inherited the host's, and the mark vanished on a dark
36
+ host. The built-in mark wears the brand mark roles instead (below). */
36
37
  color: var(--color-text-primary);
37
38
  overflow: hidden;
38
39
  transition: width var(--motion-duration-slow) var(--motion-ease-emphasized);
@@ -187,6 +188,16 @@
187
188
  flex-shrink: 0;
188
189
  }
189
190
 
191
+ /* The built-in mark's gradient: the logo's own roles, which follow the
192
+ action colour until a theme gives the logo a tone apart from it. */
193
+ .ds-app-sidebar__mark-start {
194
+ stop-color: var(--color-brand-mark);
195
+ }
196
+
197
+ .ds-app-sidebar__mark-end {
198
+ stop-color: var(--color-brand-mark-end);
199
+ }
200
+
190
201
  .ds-app-sidebar__logo-text {
191
202
  font-family: var(--font-paragraph-emphasis-family);
192
203
  font-size: var(--font-paragraph-emphasis-size);
@@ -26,6 +26,7 @@ function isCount(badge) {
26
26
  return typeof badge === "number" || /^\d+\+?$/.test(badge.trim());
27
27
  }
28
28
  function DefaultLogo() {
29
+ const gradientId = `ds-app-sidebar-mark-${useId().replace(/:/g, "")}`;
29
30
  return /* @__PURE__ */ jsxs(
30
31
  "svg",
31
32
  {
@@ -35,14 +36,18 @@ function DefaultLogo() {
35
36
  xmlns: "http://www.w3.org/2000/svg",
36
37
  "aria-hidden": "true",
37
38
  children: [
39
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gradientId, gradientUnits: "userSpaceOnUse", x1: "0", y1: "5", x2: "0", y2: "91", children: [
40
+ /* @__PURE__ */ jsx("stop", { offset: "0", className: "ds-app-sidebar__mark-start" }),
41
+ /* @__PURE__ */ jsx("stop", { offset: "1", className: "ds-app-sidebar__mark-end" })
42
+ ] }) }),
38
43
  /* @__PURE__ */ jsx(
39
44
  "path",
40
45
  {
41
46
  d: "M20.5 31L31.5 25L31.5 50.28L17.78 64L2.22 64L20.5 45.72ZM64.5 31L75.5 25L75.5 45.72L93.78 64L78.22 64L64.5 50.28Z",
42
- fill: "currentColor"
47
+ fill: `url(#${gradientId})`
43
48
  }
44
49
  ),
45
- /* @__PURE__ */ jsx("path", { d: "M42 11L54 5L54 85L42 91Z", fill: "currentColor" })
50
+ /* @__PURE__ */ jsx("path", { d: "M42 11L54 5L54 85L42 91Z", fill: `url(#${gradientId})` })
46
51
  ]
47
52
  }
48
53
  );
@@ -7,6 +7,7 @@ import { renderTypeMark } from "./typeMark.js";
7
7
  import { AttachmentViewer } from "./AttachmentViewer.js";
8
8
  import "./Attachment.css";
9
9
  import { useLocale } from "../../behaviors/LocaleProvider.js";
10
+ import { LoadingImage } from "../../behaviors/LoadingImage.js";
10
11
  import { revokeAttachmentUrls, useAttachments } from "./useAttachments.js";
11
12
  const isPicture = (item) => item.status === "ready" && item.kind === "image" && Boolean(item.previewSrc);
12
13
  const AttachmentGroup = React.forwardRef(
@@ -71,7 +72,7 @@ const AttachmentGroup = React.forwardRef(
71
72
  const onClick = clickHandler(single);
72
73
  const sized = Boolean(single.width && single.height);
73
74
  const image = /* @__PURE__ */ jsx(
74
- "img",
75
+ LoadingImage,
75
76
  {
76
77
  className: [`${baseClass}__single-image`, sized && `${baseClass}__single-image--sized`].filter(Boolean).join(" "),
77
78
  src: single.previewSrc,
@@ -6,6 +6,7 @@ import { renderTypeMark } from "./typeMark.js";
6
6
  import "../../fonts/material-symbols.css";
7
7
  import "./Attachment.css";
8
8
  import "../../behaviors/visually-hidden.css";
9
+ import { LoadingImage } from "../../behaviors/LoadingImage.js";
9
10
  const AttachmentTile = React.forwardRef(
10
11
  ({
11
12
  name,
@@ -107,7 +108,7 @@ const AttachmentTile = React.forwardRef(
107
108
  let content = stack;
108
109
  if (showPreview) {
109
110
  content = /* @__PURE__ */ jsxs(Fragment, { children: [
110
- /* @__PURE__ */ jsx("img", { className: `${baseClass}__preview`, src: previewSrc, alt: previewAlt ?? name }),
111
+ /* @__PURE__ */ jsx(LoadingImage, { className: `${baseClass}__preview`, src: previewSrc, alt: previewAlt ?? name }),
111
112
  (previewMark ?? kind !== "image") && /* @__PURE__ */ jsx("span", { className: `${baseClass}__corner`, children: cornerMark })
112
113
  ] });
113
114
  } else if (showExcerpt) {
@@ -65,8 +65,14 @@
65
65
  VARIANT — NEUTRAL
66
66
  ============================================ */
67
67
 
68
+ /* The neutral fill is the grey a hovered and a striped table row are
69
+ painted in, so on those rows the badge would lose its shape. It alone
70
+ colours the hairline every badge reserves, in the container border: an
71
+ edge, not a status signal, so the fill still carries the meaning. On a
72
+ selected row, which is the border's own grey, the fill shows instead. */
68
73
  .ds-badge--neutral {
69
74
  background-color: var(--color-status-neutral-bg);
75
+ border-color: var(--color-bg-container-border);
70
76
  color: var(--color-status-neutral-text);
71
77
  }
72
78
 
@@ -7,8 +7,11 @@
7
7
 
8
8
  @layer rift.components {
9
9
 
10
+ /* As wide as its trail and never wider than its container, so a host can
11
+ centre it or set it beside something; in normal flow it still fills the
12
+ row, as any block does. */
10
13
  .ds-breadcrumb {
11
- width: 100%;
14
+ max-width: 100%;
12
15
  }
13
16
 
14
17
  /* ============================================