rift-ds 1.39.0 → 1.41.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 (95) hide show
  1. package/README.md +9 -5
  2. package/behaviors/shell.css +9 -11
  3. package/behaviors/top-layer.css +28 -0
  4. package/behaviors/useAnchoredPosition.d.ts +12 -9
  5. package/behaviors/useAnchoredPosition.js +3 -0
  6. package/bin/rift-ds.mjs +3 -0
  7. package/bin/templates/blocks/app/notifications/Inbox.tsx +163 -0
  8. package/bin/templates/blocks/app/notifications/page.module.css +63 -0
  9. package/bin/templates/blocks/app/notifications/page.tsx +13 -0
  10. package/bin/templates/blocks/app/settings/Settings.tsx +483 -0
  11. package/bin/templates/blocks/app/settings/page.module.css +160 -6
  12. package/bin/templates/blocks/app/settings/page.tsx +10 -78
  13. package/bin/templates/blocks/components/blocks/AppShell.module.css +16 -244
  14. package/bin/templates/blocks/components/blocks/AppShell.tsx +276 -85
  15. package/bin/templates/blocks/registry.json +16 -3
  16. package/chat/ChatLauncher.d.ts +2 -2
  17. package/chat/ChatWidget.css +7 -7
  18. package/chat/ChatWidget.d.ts +1 -1
  19. package/components/AppLayout/AppLayout.css +65 -1
  20. package/components/AppLayout/AppLayout.d.ts +10 -2
  21. package/components/AppLayout/AppLayout.js +7 -2
  22. package/components/AppSidebar/AppSidebar.css +33 -20
  23. package/components/AppSidebar/AppSidebar.d.ts +4 -4
  24. package/components/AppSidebar/AppSidebar.js +13 -7
  25. package/components/AppToolbar/AppToolbar.css +143 -0
  26. package/components/AppToolbar/AppToolbar.d.ts +124 -0
  27. package/components/AppToolbar/AppToolbar.js +119 -0
  28. package/components/Avatar/Avatar.css +18 -5
  29. package/components/Avatar/Avatar.d.ts +2 -0
  30. package/components/Avatar/Avatar.js +2 -1
  31. package/components/AvatarGroup/AvatarGroup.css +8 -1
  32. package/components/AvatarGroup/AvatarGroup.d.ts +6 -0
  33. package/components/AvatarGroup/AvatarGroup.js +2 -2
  34. package/components/ColourSwatch/ColourSwatch.css +49 -0
  35. package/components/ColourSwatch/ColourSwatch.d.ts +9 -1
  36. package/components/ColourSwatch/ColourSwatch.js +12 -1
  37. package/components/CommandPaletteTrigger/CommandPaletteTrigger.css +13 -0
  38. package/components/CommandPaletteTrigger/CommandPaletteTrigger.d.ts +7 -0
  39. package/components/CommandPaletteTrigger/CommandPaletteTrigger.js +2 -0
  40. package/components/DataTable/DataTable.css +63 -0
  41. package/components/DataTable/DataTable.d.ts +26 -2
  42. package/components/DataTable/DataTable.js +116 -90
  43. package/components/DrillMenu/DrillMenu.d.ts +2 -1
  44. package/components/DrillMenu/DrillMenu.js +14 -3
  45. package/components/EntitySwitcher/EntitySwitcher.css +2 -1
  46. package/components/Icon/Icon.css +6 -1
  47. package/components/Icon/Icon.d.ts +3 -1
  48. package/components/Icon/Icon.js +2 -0
  49. package/components/NotificationCenter/NotificationCenter.css +145 -99
  50. package/components/NotificationCenter/NotificationCenter.d.ts +58 -4
  51. package/components/NotificationCenter/NotificationCenter.js +71 -63
  52. package/components/PaymentCard/PaymentCard.css +182 -0
  53. package/components/PaymentCard/PaymentCard.d.ts +80 -0
  54. package/components/PaymentCard/PaymentCard.js +80 -0
  55. package/components/PixelAvatar/PixelAvatar.css +7 -1
  56. package/components/PixelAvatar/PixelAvatar.d.ts +2 -0
  57. package/components/PixelAvatar/PixelAvatar.js +2 -1
  58. package/components/RadioButton/RadioButton.d.ts +2 -1
  59. package/components/RadioButton/RadioButton.js +1 -0
  60. package/components/ShaderField/useShaderField.js +2 -2
  61. package/components/ShaderScene/ShaderScene.js +2 -2
  62. package/components/SiteHeader/SiteHeader.css +0 -9
  63. package/components/SourceChip/SourceChip.css +2 -1
  64. package/components/Stat/Stat.css +19 -19
  65. package/components/SubNavPanel/SubNavPanel.css +10 -9
  66. package/components/Table/Table.css +310 -0
  67. package/components/Table/Table.d.ts +28 -2
  68. package/components/Table/Table.js +26 -9
  69. package/components/registry.json +34 -4
  70. package/components/registry.json.d.ts +34 -4
  71. package/components/registry.json.js +1 -1
  72. package/index.d.ts +2 -0
  73. package/index.js +4 -0
  74. package/package.json +3 -2
  75. package/tokens/motion.d.ts +2 -0
  76. package/tokens/motion.js +2 -0
  77. package/tokens/presets/contrast.css +68 -20
  78. package/tokens/presets/coral.css +38 -1
  79. package/tokens/presets/forest.css +41 -1
  80. package/tokens/presets/gold.css +35 -1
  81. package/tokens/presets/marquee.css +40 -1
  82. package/tokens/presets/mono.css +79 -1
  83. package/tokens/presets/pink.css +38 -1
  84. package/tokens/presets/plum.css +41 -1
  85. package/tokens/presets/terminal.css +36 -1
  86. package/tokens/presets/violet.css +90 -22
  87. package/tokens/presets/warm.css +33 -1
  88. package/tokens/presets/zest.css +45 -1
  89. package/tokens/registry.json +1 -0
  90. package/tokens/registry.json.d.ts +1 -0
  91. package/tokens/registry.json.js +1 -1
  92. package/tokens/tokens-dark.css +1 -0
  93. package/tokens/tokens-light.css +5 -0
  94. package/tokens/values.json.js +1 -1
  95. package/bin/templates/blocks/app/settings/ProfileForm.tsx +0 -98
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <!-- banner:start -->
2
- <a href="https://rift-ds.com"><img src="https://raw.githubusercontent.com/robritacca-dotcom/rift-ds/main/.github/readme-banner.jpg" alt="Rift DS, the AI-ready React design system" width="100%"></a>
2
+ <a href="https://rift-ds.com"><img src="https://raw.githubusercontent.com/robritacca-dotcom/rift-ds/main/.github/readme-banner.jpg" alt="Rift DS, the open-source, AI-native design system" width="100%"></a>
3
3
  <!-- banner:end -->
4
4
 
5
5
  # Rift DS
@@ -13,7 +13,7 @@ An open source React design system built for AI products and coding agents: comp
13
13
 
14
14
  ## Why Rift DS
15
15
 
16
- - **<!-- component-count -->196<!-- /component-count --> components.** Buttons, forms and tables through to charts, navigation and overlays, each typed and documented with live examples. Every one forwards a ref and your own attributes to its element, state you can own works controlled or uncontrolled (a modal opens when your app says so, by design), and every word a component writes has a prop you can localise. The build checks the first two on every component, and the words wherever they sit in markup. React and React DOM are the only required peer dependencies.
16
+ - **<!-- component-count -->198<!-- /component-count --> components.** Buttons, forms and tables through to charts, navigation and overlays, each typed and documented with live examples. Every one forwards a ref and your own attributes to its element, state you can own works controlled or uncontrolled (a modal opens when your app says so, by design), and every word a component writes has a prop you can localise. The build checks the first two on every component, and the words wherever they sit in markup. React and React DOM are the only required peer dependencies.
17
17
  - **A matching <!-- figma-kit-link -->[Figma kit](https://www.figma.com/community/file/1701820123445795117)<!-- /figma-kit-link -->.** Every component has a page in it, with a sticker sheet of its states, built on variables named after the same tokens. Duplicate it from the Figma Community to design with the same system.
18
18
  - **AI patterns, the whole chat and templates, ready to use.** Composer, streaming chat thread, tool calls, reasoning and thread panel are in the box, the complete AI chat ships assembled as one widget that one command scaffolds, and the docs site has complete template screens built from them.
19
19
  - **Fully themeable.** The shipped themes are complete looks to start from, each in light and dark. One `data-brand` attribute applies a theme, and a few CSS overrides make your own.
@@ -113,13 +113,13 @@ import 'rift-ds/tokens/presets/presets.css';
113
113
 
114
114
  ## Components
115
115
 
116
- <!-- component-count -->196<!-- /component-count --> components, including a chat set for AI products (Chat thread, Composer, Tool call, Reasoning, Thread panel) and Shader field, a WebGL2 ambient background whose light sources read your colour tokens at runtime, so it re-themes with everything else. Details and live examples are on the [docs site](https://rift-ds.com/components).
116
+ <!-- component-count -->198<!-- /component-count --> components, including a chat set for AI products (Chat thread, Composer, Tool call, Reasoning, Thread panel) and Shader field, a WebGL2 ambient background whose light sources read your colour tokens at runtime, so it re-themes with everything else. Details and live examples are on the [docs site](https://rift-ds.com/components).
117
117
 
118
118
  <details>
119
119
  <summary>The full list</summary>
120
120
 
121
121
  <!-- component-list:start -->
122
- Accordion · Action bar · Action card · Action readout · Agent plan · Agent rail · Agent status · AI button · Alert · Alert dialog · Anchor nav · Animated number · App layout · App sidebar · Area chart · Artifact card · Artifact panel · Attachment drop zone · Attachment group · Attachment tile · Attachment viewer · Avatar · Avatar group · Back to top · Badge · Banner · Bar chart · Bento tile · Bento tile art · Bottom nav · Breadcrumb · Button · Button group · Card · Card stack · Carousel · Chat header · Chat marker · Chat message · Chat thread · Checkbox · Checklist · Chip · Code block · Code diff · Colour picker · Combo chart · Combobox · Command palette · Command palette trigger · Composer · Contact card · Context menu · Contribution graph · Copy button · Currency input · Data table · Date input · Date picker · Date range picker · Deadline · Decision row · Description list · Dialog · Divider · Document chip · Document viewer · Drawer · Drill menu · Dropdown · Dropdown menu · Empty state · Entity card · Entity switcher · Error summary · Event calendar · Field · Figure · File input · File row · Filter bar · Form section · Funnel chart · Gantt chart · Gauge · Globe · Grid · Heading · Hover card · Icon · Icon button · Image compare · Input · Inspector colour picker · Inspector dropdown · Inspector input · Inspector section · Inspector segments · Inspector slider · Inspector toggle switch · Instructions · Interrupt card · Kbd · Legend tile · Lightbox · Line chart · Link · Link list · List · Map callout · Map legend · Masked input · Mega menu · Mention · Menu bar · Message actions · Message card · Meter · Model picker · Notification centre · Number input · Org chart · Page header · Pagination · Panel · Pie chart · Pin input · Pixel avatar · Popover · Progress bar · Progressive blur · Prompt suggestions · Prose · Question card · Quote · Radar chart · Radial chart · Radio button · Rating · Reasoning · Resource timeline · Rich dropdown · Scatter chart · Section title · Segmented control · Selection card · Shader field · Shader scene · Side nav · Signature pad · Site footer · Site header · Site layout · Skeleton · Slider · Source chip · Source trail · Sparkline · Spinner · Split button · Split pane · Stack · Stacked bar chart · Stat · Status dot · Stepper · Streaming text · Sub-nav panel · Swatch · Table · Table toolbar · Tabs · Tag input · Text · Textarea · Theme picker · Theme toggle · Thread history · Thread panel · Thread tabs · Time picker · Timeline · Toast · Toggle group · Toggle switch · Tool call · Toolbar · Tooltip · Top app bar · Tree view · Treemap · Usage card · Waveform · Widget · Wizard · World map
122
+ Accordion · Action bar · Action card · Action readout · Agent plan · Agent rail · Agent status · AI button · Alert · Alert dialog · Anchor nav · Animated number · App layout · App sidebar · App toolbar · Area chart · Artifact card · Artifact panel · Attachment drop zone · Attachment group · Attachment tile · Attachment viewer · Avatar · Avatar group · Back to top · Badge · Banner · Bar chart · Bento tile · Bento tile art · Bottom nav · Breadcrumb · Button · Button group · Card · Card stack · Carousel · Chat header · Chat marker · Chat message · Chat thread · Checkbox · Checklist · Chip · Code block · Code diff · Colour picker · Combo chart · Combobox · Command palette · Command palette trigger · Composer · Contact card · Context menu · Contribution graph · Copy button · Currency input · Data table · Date input · Date picker · Date range picker · Deadline · Decision row · Description list · Dialog · Divider · Document chip · Document viewer · Drawer · Drill menu · Dropdown · Dropdown menu · Empty state · Entity card · Entity switcher · Error summary · Event calendar · Field · Figure · File input · File row · Filter bar · Form section · Funnel chart · Gantt chart · Gauge · Globe · Grid · Heading · Hover card · Icon · Icon button · Image compare · Input · Inspector colour picker · Inspector dropdown · Inspector input · Inspector section · Inspector segments · Inspector slider · Inspector toggle switch · Instructions · Interrupt card · Kbd · Legend tile · Lightbox · Line chart · Link · Link list · List · Map callout · Map legend · Masked input · Mega menu · Mention · Menu bar · Message actions · Message card · Meter · Model picker · Notification centre · Number input · Org chart · Page header · Pagination · Panel · Payment card · Pie chart · Pin input · Pixel avatar · Popover · Progress bar · Progressive blur · Prompt suggestions · Prose · Question card · Quote · Radar chart · Radial chart · Radio button · Rating · Reasoning · Resource timeline · Rich dropdown · Scatter chart · Section title · Segmented control · Selection card · Shader field · Shader scene · Side nav · Signature pad · Site footer · Site header · Site layout · Skeleton · Slider · Source chip · Source trail · Sparkline · Spinner · Split button · Split pane · Stack · Stacked bar chart · Stat · Status dot · Stepper · Streaming text · Sub-nav panel · Swatch · Table · Table toolbar · Tabs · Tag input · Text · Textarea · Theme picker · Theme toggle · Thread history · Thread panel · Thread tabs · Time picker · Timeline · Toast · Toggle group · Toggle switch · Tool call · Toolbar · Tooltip · Top app bar · Tree view · Treemap · Usage card · Waveform · Widget · Wizard · World map
123
123
  <!-- component-list:end -->
124
124
 
125
125
  </details>
@@ -153,4 +153,8 @@ Designed and built by [Robert Ritacca](https://robertritacca.com).
153
153
 
154
154
  ## License
155
155
 
156
- MIT, the whole repository: components, tokens, scripts, the website, and the docs. Use it in anything. See [`LICENSE`](LICENSE) for the full terms.
156
+ The package is MIT: the components, the tokens, the chat widget, the command-line tool and everything else published to npm as `rift-ds`, with the scripts that build them. Use it in anything. See [`LICENSE`](LICENSE) for the full terms.
157
+
158
+ The website is not. Its code, pages, writing and design are all rights reserved, apart from the files it publishes for use with the package, which are MIT too. See [`website/LICENSE`](website/LICENSE).
159
+
160
+ The Rift DS name, the logo, the mark and the brand's other assets are not licensed under either. A fork or a product built on the package needs its own name and logo. See [`TRADEMARKS.md`](TRADEMARKS.md).
@@ -28,10 +28,10 @@
28
28
  something, so it is the chat's alone: an
29
29
  app layout or a template is always the
30
30
  floor of its page and stays solid.
31
- - floating: the rail is a glass card held off
32
- the edges by the float gap, hairline and
33
- floating shadow; the content sits on the
34
- page.
31
+ - floating: the rail is a card on the shell
32
+ colour held off the edges by the float gap,
33
+ hairline and floating shadow; the content
34
+ is crisp on the app surface around it.
35
35
  - inset: the rail runs flush on the shell
36
36
  plane and the content is a raised surface,
37
37
  hairline and floating shadow, held off the
@@ -58,12 +58,10 @@
58
58
  --ds-shell-gap: var(--ds-shell-inset, 10px);
59
59
  --ds-shell-float-gap: var(--ds-sidebar-float-inset, 20px);
60
60
 
61
- /* The raised edge and the glass card, shared by floating and inset. */
61
+ /* The raised edge, shared by floating and inset. */
62
62
  --ds-shell-radius: var(--radius-600);
63
- --ds-shell-edge-border: var(--color-bg-container-border);
63
+ --ds-shell-edge-border: var(--color-bg-app-shell-border);
64
64
  --ds-shell-edge-shadow: var(--shadow-floating);
65
- --ds-shell-glass: var(--color-bg-glass);
66
- --ds-shell-glass-blur: blur(24px);
67
65
  }
68
66
 
69
67
  :where([data-ds-shell='flush']) {
@@ -88,9 +86,9 @@
88
86
  }
89
87
 
90
88
  :where([data-ds-shell='floating']) {
91
- --ds-shell-plane: var(--color-bg-page-primary);
92
- --ds-shell-surface: var(--color-bg-page-primary);
93
- --ds-shell-rail-bg: var(--ds-shell-glass);
89
+ --ds-shell-plane: var(--color-bg-app-surface);
90
+ --ds-shell-surface: var(--color-bg-app-surface);
91
+ --ds-shell-rail-bg: var(--color-bg-app-shell);
94
92
  --ds-shell-rail-divider: transparent;
95
93
  --ds-shell-surface-border: transparent;
96
94
  --ds-shell-surface-shadow: none;
@@ -0,0 +1,28 @@
1
+ /* ============================================
2
+ TOP LAYER
3
+ An anchored panel (src/behaviors/useAnchoredPosition)
4
+ paints in the browser's top layer while open, as a
5
+ manual popover (src/behaviors/useTopLayer), so no
6
+ ancestor's clip, mask or stacking context can hide
7
+ it: a rail's scroll fade masked a switcher's menu to
8
+ the rail's width. The browser gives a popover its own
9
+ defaults (a border, a padding, Canvas colours, a
10
+ scrolling box); these put back what an unlifted panel
11
+ had, at no specificity (:where), so every component's
12
+ own rule for its panel still wins. useAnchoredPosition
13
+ imports this sheet, so every panel it places has it.
14
+ ============================================ */
15
+
16
+ @layer rift.tokens, rift.preset, rift.components;
17
+
18
+ @layer rift.components {
19
+
20
+ :where([popover][data-side]) {
21
+ overflow: visible;
22
+ padding: 0;
23
+ border: 0;
24
+ background: none;
25
+ color: inherit;
26
+ }
27
+
28
+ } /* @layer rift.components */
@@ -3,15 +3,18 @@
3
3
  * against the control that opened it (menus, listboxes, pickers, popovers,
4
4
  * hover cards, tooltips).
5
5
  *
6
- * The panel stays where it is in the DOM, so it keeps the trigger's stacking
7
- * context (a tooltip excepted, which paints in the top layer through
8
- * src/behaviors/useTopLayer) and any theme scoped above it, but is
9
- * `position: fixed`, placed
10
- * from the anchor's rectangle. A fixed panel is not clipped by an ancestor's
11
- * `overflow`, which is what lets a menu inside a table's scroll wrapper, a
12
- * rail or a card show whole. Portals would escape the same way but would
13
- * leave the theme scope; floating-ui would solve it at the cost of a
14
- * dependency. This is the approach Tooltip proved first.
6
+ * The panel stays where it is in the DOM, so it keeps any theme scoped above
7
+ * it, but is `position: fixed`, placed from the anchor's rectangle, and while
8
+ * open it paints in the browser's top layer (src/behaviors/useTopLayer). A
9
+ * fixed panel alone escapes an ancestor's `overflow`, but not its mask or
10
+ * stacking context: a rail's scroll fade masked a switcher's menu to the
11
+ * rail's width. In the top layer nothing on the page can clip or cover it,
12
+ * which is what lets a menu inside a table's scroll wrapper, a faded rail or
13
+ * a card show whole. src/behaviors/top-layer.css undoes the browser's
14
+ * popover defaults beneath each component's own panel rule. Portals would
15
+ * escape the same way but would leave the theme scope; floating-ui would
16
+ * solve it at the cost of a dependency. This is the approach Tooltip proved
17
+ * first.
15
18
  *
16
19
  * On every placement it:
17
20
  * - puts the panel on the preferred side, flipping to the opposite side when
@@ -1,6 +1,8 @@
1
1
  "use client";
2
2
  import { useRef, useLayoutEffect } from "react";
3
3
  import { isRtl } from "./direction.js";
4
+ import { useTopLayer } from "./useTopLayer.js";
5
+ import "./top-layer.css";
4
6
  function fixedContainingBlock(element) {
5
7
  if (element.matches(":popover-open")) return null;
6
8
  for (let node = element.parentElement; node; node = node.parentElement) {
@@ -33,6 +35,7 @@ function useAnchoredPosition({
33
35
  onPlace,
34
36
  target
35
37
  }) {
38
+ useTopLayer({ open, panelRef, target });
36
39
  const onPlaceRef = useRef(onPlace);
37
40
  useLayoutEffect(() => {
38
41
  onPlaceRef.current = onPlace;
package/bin/rift-ds.mjs CHANGED
@@ -309,6 +309,9 @@ function initApp({ app, dryRun }) {
309
309
  }
310
310
  console.log(`\nIf the layout imports a globals.css from create-next-app, drop that import (or empty the file):`);
311
311
  console.log(`its body colours and font would cover the library's.`);
312
+ console.log(`\nPick a shipped theme before the first screen: the base theme is a neutral starting point, not a look.`);
313
+ console.log(`Import ${PACKAGE_NAME}/tokens/presets/<id>.css after tokens.css and set data-brand="<id>" on <html>.`);
314
+ console.log(`Compare them at ${SITE_ORIGIN}/playground.`);
312
315
  console.log(`\nThen add a first page: npx ${PACKAGE_NAME} init block dashboard (no name lists them).`);
313
316
  console.log(`Setup and theming: ${SITE_ORIGIN}/docs/get-started`);
314
317
  }
@@ -0,0 +1,163 @@
1
+ 'use client';
2
+
3
+ /**
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.
9
+ */
10
+
11
+ import { useState } from 'react';
12
+ import { Button } from 'rift-ds/components/Button/Button';
13
+ import { Dropdown } from 'rift-ds/components/Dropdown/Dropdown';
14
+ import { EmptyState } from 'rift-ds/components/EmptyState/EmptyState';
15
+ import { NotificationItem } from 'rift-ds/components/NotificationCenter/NotificationCenter';
16
+ import { Tabs } from 'rift-ds/components/Tabs/Tabs';
17
+ import { AppShell } from '../../components/blocks/AppShell';
18
+ import styles from './page.module.css';
19
+
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
+ const GROUPS = ['Today', 'This week', 'Earlier'] as const;
47
+
48
+ const CATEGORY_OPTIONS = [
49
+ { value: 'all', label: 'All categories' },
50
+ { value: 'payments', label: 'Payments' },
51
+ { value: 'cards', label: 'Cards' },
52
+ { value: 'team', label: 'Team' },
53
+ { value: 'approvals', label: 'Approvals' },
54
+ ];
55
+
56
+ export function Inbox() {
57
+ const [items, setItems] = useState(INBOX);
58
+ const [unread, setUnread] = useState<string[]>(['n1', 'n2', 'n3', 'n4']);
59
+ const [show, setShow] = useState('all');
60
+ const [category, setCategory] = useState('all');
61
+
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
+ const shown = items.filter(
69
+ (item) =>
70
+ (show === 'all' || unread.includes(item.id)) && (category === 'all' || item.category === category),
71
+ );
72
+
73
+ return (
74
+ <AppShell
75
+ activeKey="inbox"
76
+ breadcrumb={[{ label: 'Acme', href: '#' }, { label: 'Notifications' }]}
77
+ title="Notifications"
78
+ actions={
79
+ <>
80
+ <Button
81
+ label="Mark all as read"
82
+ variant="secondary"
83
+ iconLeft="done_all"
84
+ disabled={unread.length === 0}
85
+ onClick={() => setUnread([])}
86
+ />
87
+ <Button
88
+ label="Clear all"
89
+ variant="tertiary"
90
+ tone="destructive"
91
+ disabled={items.length === 0}
92
+ onClick={() => {
93
+ setItems([]);
94
+ setUnread([]);
95
+ }}
96
+ />
97
+ </>
98
+ }
99
+ >
100
+ <div className={styles.column}>
101
+ <div className={styles.filters}>
102
+ <Tabs
103
+ aria-label="Show"
104
+ tabs={[
105
+ { value: 'all', label: 'All', panelId: 'notifications-list' },
106
+ { value: 'unread', label: 'Unread', count: unread.length, panelId: 'notifications-list' },
107
+ ]}
108
+ value={show}
109
+ onValueChange={setShow}
110
+ />
111
+ <Dropdown
112
+ className={styles.category}
113
+ aria-label="Category"
114
+ options={CATEGORY_OPTIONS}
115
+ value={category}
116
+ onValueChange={setCategory}
117
+ />
118
+ </div>
119
+
120
+ <div id="notifications-list" role="tabpanel" aria-label={show === 'all' ? 'All' : 'Unread'} className={styles.groups}>
121
+ {shown.length === 0 ? (
122
+ <EmptyState
123
+ icon="notifications"
124
+ title={items.length === 0 ? 'No notifications' : 'You’re all caught up'}
125
+ description={
126
+ items.length === 0
127
+ ? 'New notifications will collect here as they arrive.'
128
+ : 'Nothing here matches these filters.'
129
+ }
130
+ />
131
+ ) : (
132
+ GROUPS.map((group) => {
133
+ const rows = shown.filter((item) => item.group === group);
134
+ if (rows.length === 0) return null;
135
+ return (
136
+ <section key={group} className={styles.group} aria-labelledby={`group-${group}`}>
137
+ <h2 id={`group-${group}`} className={styles.groupLabel}>
138
+ {group}
139
+ </h2>
140
+ <div className={styles.list}>
141
+ {rows.map((item) => (
142
+ <NotificationItem
143
+ key={item.id}
144
+ media={item.icon}
145
+ title={item.title}
146
+ time={item.time}
147
+ unread={unread.includes(item.id)}
148
+ onSelect={() => read(item.id)}
149
+ onDismiss={() => dismiss(item.id)}
150
+ >
151
+ {item.text}
152
+ </NotificationItem>
153
+ ))}
154
+ </div>
155
+ </section>
156
+ );
157
+ })
158
+ )}
159
+ </div>
160
+ </div>
161
+ </AppShell>
162
+ );
163
+ }
@@ -0,0 +1,63 @@
1
+ /* The notifications column: the filters over the list, across the whole
2
+ content column, with each row's time held to the far edge. Each day's
3
+ rows sit under a quiet label, the rows themselves the notification
4
+ panel's own, so the page and the panel read as one list at two sizes. */
5
+
6
+ .column {
7
+ display: flex;
8
+ flex-direction: column;
9
+ gap: var(--gap-500);
10
+ }
11
+
12
+ .filters {
13
+ display: flex;
14
+ flex-wrap: wrap;
15
+ align-items: center;
16
+ justify-content: space-between;
17
+ gap: var(--gap-300);
18
+ }
19
+
20
+ .groups {
21
+ display: flex;
22
+ flex-direction: column;
23
+ gap: var(--gap-500);
24
+ }
25
+
26
+ .category {
27
+ width: 220px; /* room for the longest category */
28
+ }
29
+
30
+ .group {
31
+ display: flex;
32
+ flex-direction: column;
33
+ gap: var(--gap-100);
34
+ }
35
+
36
+ /* The palette's group label: small, tertiary, inset to the rows' text. */
37
+ .groupLabel {
38
+ margin: 0;
39
+ padding: 0 var(--padding-300);
40
+ color: var(--color-text-tertiary);
41
+ font-family: var(--font-paragraph-sm-emphasis-family);
42
+ font-size: var(--font-paragraph-sm-emphasis-size);
43
+ font-weight: var(--font-paragraph-sm-emphasis-weight);
44
+ line-height: var(--font-paragraph-sm-emphasis-line-height);
45
+ letter-spacing: var(--font-paragraph-sm-emphasis-letter-spacing);
46
+ }
47
+
48
+ .list {
49
+ display: flex;
50
+ flex-direction: column;
51
+ }
52
+
53
+ /* On the page the rows part with a rule, as a long list reads best; the
54
+ panel keeps the palette's unruled rows. */
55
+ .list > :global(.ds-notification-item) + :global(.ds-notification-item) {
56
+ border-top: var(--border-025) solid var(--color-divider);
57
+ }
58
+
59
+ @media (max-width: 480px) {
60
+ .category {
61
+ width: 100%;
62
+ }
63
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The notifications block: the full list a notification panel's See all
3
+ * opens, the same rows the panel shows, laid out as a page. Filter by All or
4
+ * Unread and by category, open a row to read it, clear one with its close
5
+ * button, or read or clear them all from the page header. The notifications
6
+ * are placeholders (Inbox.tsx beside this page holds them); read your own.
7
+ */
8
+
9
+ import { Inbox } from './Inbox';
10
+
11
+ export default function NotificationsPage() {
12
+ return <Inbox />;
13
+ }