rift-ds 1.23.0 → 1.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,119 @@
1
+ /* ============================================
2
+ THE SHELL RECIPE
3
+ The one home of what each app shell mode is
4
+ made of, so every host draws the same three:
5
+ AppLayout and AppSidebar, ChatWidget when it
6
+ is the page, and the site's TemplateShell.
7
+ Each host imports this file, marks its root
8
+ with data-ds-shell (and, for a chat in
9
+ flush, data-ds-shell-backdrop), and reads
10
+ these properties
11
+ instead of restating a token.
12
+
13
+ A mode decides four things: the plane (what
14
+ the page is), the surface (what the content
15
+ sits on), the rail (how the navigation meets
16
+ the plane) and the edge. The edge belongs to
17
+ the mode, never a choice of its own:
18
+
19
+ - flush: no gap and nothing raised. The rail
20
+ sits on the shell plane behind a hairline
21
+ divider; the content is crisp on the app
22
+ surface. A chat seated as a page has one
23
+ lever more, the backdrop: solid, or blur
24
+ (the site chat's takeover: the glass token
25
+ and a 40px blur over whatever lies behind,
26
+ with the rail and the conversation clear
27
+ on it). Blur says the chat rests above
28
+ something, so it is the chat's alone: an
29
+ app layout or a template is always the
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.
35
+ - inset: the rail runs flush on the shell
36
+ plane and the content is a raised surface,
37
+ hairline and floating shadow, held off the
38
+ other edges by the inset gap.
39
+
40
+ Declared on the marked root, not on :root, so
41
+ a theme scoped to part of a page reaches it.
42
+ design.md's "App shells" section owns the
43
+ rules these encode.
44
+ ============================================ */
45
+
46
+ :where([data-ds-shell]) {
47
+ /* The two gaps. The inset gap's value lives with AppSidebar's root rule
48
+ (--ds-shell-inset) and the float gap's with the floating rail
49
+ (--ds-sidebar-float-inset); both are read here. */
50
+ --ds-shell-gap: var(--ds-shell-inset, 10px);
51
+ --ds-shell-float-gap: var(--ds-sidebar-float-inset, 20px);
52
+
53
+ /* The raised edge and the glass card, shared by floating and inset. */
54
+ --ds-shell-radius: var(--radius-600);
55
+ --ds-shell-edge-border: var(--color-bg-container-border);
56
+ --ds-shell-edge-shadow: var(--shadow-floating);
57
+ --ds-shell-glass: var(--color-bg-glass);
58
+ --ds-shell-glass-blur: blur(24px);
59
+ }
60
+
61
+ :where([data-ds-shell='flush']) {
62
+ --ds-shell-plane: var(--color-bg-app-shell);
63
+ --ds-shell-surface: var(--color-bg-app-surface);
64
+ --ds-shell-rail-bg: var(--color-bg-app-shell);
65
+ --ds-shell-rail-divider: var(--color-bg-container-border);
66
+ --ds-shell-surface-border: transparent;
67
+ --ds-shell-surface-shadow: none;
68
+ --ds-shell-surface-radius: 0;
69
+ }
70
+
71
+ /* Blur, a chat's alone: the plane is the glass over what lies behind, so
72
+ the rail and the conversation clear their own fills and the divider
73
+ stays. */
74
+ :where([data-ds-shell='flush'][data-ds-shell-backdrop='blur']) {
75
+ --ds-shell-plane: transparent;
76
+ --ds-shell-surface: transparent;
77
+ --ds-shell-rail-bg: transparent;
78
+ --ds-shell-backdrop-fill: var(--color-bg-glass);
79
+ --ds-shell-backdrop-filter: blur(40px);
80
+ }
81
+
82
+ :where([data-ds-shell='floating']) {
83
+ --ds-shell-plane: var(--color-bg-page-primary);
84
+ --ds-shell-surface: var(--color-bg-page-primary);
85
+ --ds-shell-rail-bg: var(--ds-shell-glass);
86
+ --ds-shell-rail-divider: transparent;
87
+ --ds-shell-surface-border: transparent;
88
+ --ds-shell-surface-shadow: none;
89
+ --ds-shell-surface-radius: 0;
90
+ }
91
+
92
+ :where([data-ds-shell='inset']) {
93
+ --ds-shell-plane: var(--color-bg-app-shell);
94
+ --ds-shell-surface: var(--color-bg-app-surface);
95
+ --ds-shell-rail-bg: var(--color-bg-app-shell);
96
+ --ds-shell-rail-divider: transparent;
97
+ --ds-shell-surface-border: var(--ds-shell-edge-border);
98
+ --ds-shell-surface-shadow: var(--ds-shell-edge-shadow);
99
+ --ds-shell-surface-radius: var(--ds-shell-radius);
100
+ }
101
+
102
+ /* The blur backdrop, drawn once for any host: a fixed layer behind the
103
+ host's content rather than a filter on the host itself, which would
104
+ become the containing block of every fixed descendant (AppSidebar, the
105
+ chat's sheets) and carry them off when the page scrolls. */
106
+ :where([data-ds-shell='flush'][data-ds-shell-backdrop='blur']) {
107
+ position: relative;
108
+ isolation: isolate;
109
+ }
110
+
111
+ :where([data-ds-shell='flush'][data-ds-shell-backdrop='blur'])::before {
112
+ content: '';
113
+ position: fixed;
114
+ inset: 0;
115
+ z-index: -1;
116
+ pointer-events: none;
117
+ background-color: var(--ds-shell-backdrop-fill);
118
+ backdrop-filter: var(--ds-shell-backdrop-filter);
119
+ }
@@ -1,31 +1,72 @@
1
- /* The app shell's layout. Every value is a rift-ds token except the
2
- sidebar's own widths (64px collapsed, 280px expanded) and its mobile
3
- menu button (40px), which are the AppSidebar component's geometry. */
1
+ /* The app shell's layout, in one of the three app shell modes (flush,
2
+ floating or inset; AppShell.tsx's SHELL_LAYOUT picks it). Every value is
3
+ a rift-ds token or a property of its shell recipe, except the sidebar's
4
+ own widths (64px collapsed, 280px expanded) and its mobile menu button
5
+ (40px), which are the AppSidebar component's geometry. */
4
6
 
5
7
  .shell {
6
- /* One inset for the floating sidebar and the gap it leaves. */
8
+ /* One inset for the floating sidebar and the gap it leaves, and the
9
+ content's top inset. */
7
10
  --shell-inset: var(--padding-500);
8
11
  --ds-sidebar-float-inset: var(--shell-inset);
12
+ /* The rail's width, which the main column clears. */
13
+ --shell-rail: 64px;
9
14
 
10
15
  display: flex;
11
16
  min-width: 0;
12
17
  min-height: 100dvh;
13
- background-color: var(--color-bg-page-primary);
18
+ /* The plane, from rift-ds's shell recipe: the root's data-ds-shell
19
+ marker (AppShell.tsx's SHELL_LAYOUT) picks the mode, and AppSidebar
20
+ brings the recipe's stylesheet with it. */
21
+ background-color: var(--ds-shell-plane);
14
22
  }
15
23
 
16
- /* The sidebar is fixed, so the main column reserves its width: the rail
17
- plus the inset on either side of it. */
24
+ .shell:has(:global(.ds-app-sidebar--expanded)) {
25
+ --shell-rail: 280px;
26
+ }
27
+
28
+ /* The sidebar is fixed, so the main column reserves its width: the rail,
29
+ plus the float gap either side of it in the floating layout. */
18
30
  .main {
19
31
  flex: 1;
20
32
  min-width: 0;
21
33
  display: flex;
22
34
  justify-content: center;
23
- padding-left: calc(64px + var(--shell-inset) * 2);
24
- transition: padding-left var(--motion-duration-slow) var(--motion-ease-emphasized);
35
+ padding-left: var(--shell-rail);
36
+ transition: padding var(--motion-duration-slow) var(--motion-ease-emphasized);
37
+ }
38
+
39
+ .shell[data-ds-shell='floating'] .main {
40
+ padding-left: calc(var(--shell-rail) + var(--shell-inset) * 2);
41
+ }
42
+
43
+ /* The content's ground: the crisp surface beside the flush rail, the page
44
+ itself when floating, and a raised surface
45
+ held off the edges in the inset layout, scrolling inside itself. */
46
+ .surface {
47
+ display: flex;
48
+ justify-content: center;
49
+ flex: 1;
50
+ min-width: 0;
51
+ background-color: var(--ds-shell-surface);
52
+ }
53
+
54
+ .shell[data-ds-shell='inset'] {
55
+ height: 100dvh;
56
+ min-height: 0;
57
+ }
58
+
59
+ .shell[data-ds-shell='inset'] .main {
60
+ min-height: 0;
61
+ padding: var(--ds-shell-gap);
62
+ padding-left: var(--shell-rail);
25
63
  }
26
64
 
27
- .mainExpanded {
28
- padding-left: calc(280px + var(--shell-inset) * 2);
65
+ .shell[data-ds-shell='inset'] .surface {
66
+ overflow-y: auto;
67
+ border: var(--border-025) solid var(--ds-shell-surface-border);
68
+ border-radius: var(--ds-shell-surface-radius);
69
+ box-shadow: var(--ds-shell-surface-shadow);
29
70
  }
30
71
 
31
72
  .content {
@@ -65,7 +106,7 @@
65
106
  bottom: 0;
66
107
  inset-inline: calc(-1 * var(--padding-400));
67
108
  z-index: -1;
68
- background: linear-gradient(to bottom, var(--color-bg-page-primary) var(--shell-inset), transparent);
109
+ background: linear-gradient(to bottom, var(--ds-shell-surface) var(--shell-inset), transparent);
69
110
  pointer-events: none;
70
111
  opacity: 0;
71
112
  transition: opacity var(--motion-duration-base) var(--motion-ease-standard);
@@ -172,9 +213,22 @@
172
213
  --shell-inset: var(--padding-400);
173
214
  }
174
215
 
175
- .main,
176
- .mainExpanded {
177
- padding-left: 0;
216
+ .shell .main,
217
+ .shell[data-ds-shell] .main {
218
+ padding: 0;
219
+ }
220
+
221
+ /* The inset surface gives way: the page scrolls, edge to edge. */
222
+ .shell[data-ds-shell='inset'] {
223
+ height: auto;
224
+ min-height: 100dvh;
225
+ }
226
+
227
+ .shell[data-ds-shell='inset'] .surface {
228
+ overflow: visible;
229
+ border: none;
230
+ border-radius: 0;
231
+ box-shadow: none;
178
232
  }
179
233
 
180
234
  .content {
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
 
3
3
  /**
4
- * The app shell every rift-ds block page sits in: the floating sidebar, a
5
- * top bar (search, the AI entry and the colour mode), a page header
4
+ * The app shell every rift-ds block page sits in: the sidebar in one of
5
+ * rift-ds's three app shell modes (SHELL_LAYOUT below), a top bar (search, the AI entry and the colour mode), a page header
6
6
  * (breadcrumb, title, actions) and the content column, with the spacing
7
7
  * set. This file is yours: rename the product, change the navigation, and
8
8
  * grow it with your app.
@@ -11,7 +11,7 @@
11
11
  * it: bare while the page is at the top, then a fill above it and the
12
12
  * library's ProgressiveBlur behind it fade in once the page scrolls.
13
13
  *
14
- * Responsive by construction: above 768px the sidebar floats beside the
14
+ * Responsive by construction: above 768px the sidebar sits beside the
15
15
  * page and the content moves over by its width; below it the sidebar
16
16
  * becomes a drawer behind its own menu button, the search field folds to
17
17
  * its icon, and the content runs edge to edge at a tighter gutter.
@@ -21,6 +21,7 @@ import { useEffect, useRef, useState, type ReactNode } from 'react';
21
21
  import { AiButton } from 'rift-ds/components/AiButton/AiButton';
22
22
  import {
23
23
  AppSidebar,
24
+ type AppSidebarLayout,
24
25
  type AppSidebarProfile,
25
26
  type AppSidebarSection,
26
27
  } from 'rift-ds/components/AppSidebar/AppSidebar';
@@ -30,6 +31,15 @@ import { ProgressiveBlur } from 'rift-ds/components/ProgressiveBlur/ProgressiveB
30
31
  import { ThemeToggle } from 'rift-ds/components/ThemeToggle/ThemeToggle';
31
32
  import styles from './AppShell.module.css';
32
33
 
34
+ /**
35
+ * How the sidebar and the content meet the page, one of the three app shell
36
+ * modes: `flush` runs the sidebar edge to edge on the shell colour behind a
37
+ * hairline, the content crisp beside it; `floating` lifts the sidebar into a
38
+ * glass card off the edges; `inset` runs it flush and sets the content in a
39
+ * raised surface held off the other edges, scrolling inside itself.
40
+ */
41
+ const SHELL_LAYOUT: AppSidebarLayout = 'floating';
42
+
33
43
  /** The product's name, shown beside the logo in the sidebar. */
34
44
  const PRODUCT_NAME = 'Acme';
35
45
 
@@ -87,7 +97,10 @@ export function AppShell({ activeKey, breadcrumb, title, actions, children }: Ap
87
97
  }, []);
88
98
 
89
99
  return (
90
- <div className={styles.shell}>
100
+ <div
101
+ className={styles.shell}
102
+ data-ds-shell={SHELL_LAYOUT}
103
+ >
91
104
  <AppSidebar
92
105
  sections={NAV_SECTIONS}
93
106
  profile={PROFILE}
@@ -95,36 +108,38 @@ export function AppShell({ activeKey, breadcrumb, title, actions, children }: Ap
95
108
  expanded={expanded}
96
109
  onExpandedChange={setExpanded}
97
110
  logoText={PRODUCT_NAME}
98
- layout="floating"
111
+ layout={SHELL_LAYOUT}
99
112
  />
100
113
 
101
- <div className={`${styles.main} ${expanded ? styles.mainExpanded : ''}`}>
102
- <div className={styles.content}>
103
- <div ref={markerRef} className={styles.topBarMarker} aria-hidden="true" />
104
- <header className={styles.topBar} data-stuck={stuck ? '' : undefined}>
105
- <ProgressiveBlur className={styles.topBarBlur} tinted={stuck} />
106
- {/* Wire both to your command palette: CommandPalette from
107
- rift-ds, opened from here and from Cmd+K. */}
108
- <CommandPaletteTrigger className={styles.search} />
109
- <div className={styles.topBarActions}>
110
- <CommandPaletteTrigger iconOnly className={styles.searchIcon} />
111
- {/* The AI entry. Point it at your chat: `npx rift-ds init chat`
112
- scaffolds one, and ChatLauncher opens it. */}
113
- <AiButton />
114
- <ThemeToggle showLabels={false} />
115
- </div>
116
- </header>
114
+ <div className={styles.main}>
115
+ <div className={styles.surface}>
116
+ <div className={styles.content}>
117
+ <div ref={markerRef} className={styles.topBarMarker} aria-hidden="true" />
118
+ <header className={styles.topBar} data-stuck={stuck ? '' : undefined}>
119
+ <ProgressiveBlur className={styles.topBarBlur} tinted={stuck} />
120
+ {/* Wire both to your command palette: CommandPalette from
121
+ rift-ds, opened from here and from Cmd+K. */}
122
+ <CommandPaletteTrigger className={styles.search} />
123
+ <div className={styles.topBarActions}>
124
+ <CommandPaletteTrigger iconOnly className={styles.searchIcon} />
125
+ {/* The AI entry. Point it at your chat: `npx rift-ds init chat`
126
+ scaffolds one, and ChatLauncher opens it. */}
127
+ <AiButton />
128
+ <ThemeToggle showLabels={false} />
129
+ </div>
130
+ </header>
117
131
 
118
- <main className={styles.page}>
119
- <div className={styles.pageHead}>
120
- <div className={styles.pageHeadText}>
121
- {breadcrumb && <Breadcrumb items={breadcrumb} />}
122
- <h1 className={styles.title}>{title}</h1>
132
+ <main className={styles.page}>
133
+ <div className={styles.pageHead}>
134
+ <div className={styles.pageHeadText}>
135
+ {breadcrumb && <Breadcrumb items={breadcrumb} />}
136
+ <h1 className={styles.title}>{title}</h1>
137
+ </div>
138
+ {actions && <div className={styles.pageActions}>{actions}</div>}
123
139
  </div>
124
- {actions && <div className={styles.pageActions}>{actions}</div>}
125
- </div>
126
- {children}
127
- </main>
140
+ {children}
141
+ </main>
142
+ </div>
128
143
  </div>
129
144
  </div>
130
145
  </div>
@@ -4,7 +4,7 @@
4
4
  {
5
5
  "name": "app-shell",
6
6
  "label": "App shell",
7
- "description": "The floating sidebar, a top bar with search, the AI entry and the colour mode, a page header, and an empty page with the spacing set.",
7
+ "description": "A sidebar in your pick of the three shell modes, a top bar with search, AI and colour mode, a page header, and an empty page with the spacing set.",
8
8
  "route": "/starter",
9
9
  "files": [
10
10
  "components/blocks/AppShell.tsx",
@@ -19,13 +19,13 @@
19
19
  margin-top: var(--gap-400);
20
20
  }
21
21
 
22
+ /* The rails' one group heading (design.md's App shells): paragraph small
23
+ in the tertiary text, mixed case, as the history rail beside it. */
22
24
  .ds-chat-agent-pane__heading {
23
- font-family: var(--font-overline-family);
24
- font-size: var(--font-overline-size);
25
- font-weight: var(--font-overline-weight);
26
- line-height: var(--font-overline-line-height);
27
- letter-spacing: var(--font-overline-letter-spacing);
28
- text-transform: uppercase;
25
+ font-family: var(--font-paragraph-sm-family);
26
+ font-size: var(--font-paragraph-sm-size);
27
+ font-weight: var(--font-paragraph-sm-weight);
28
+ line-height: var(--font-paragraph-sm-line-height);
29
29
  color: var(--color-text-tertiary);
30
30
  padding: var(--padding-100) var(--padding-200);
31
31
  margin: 0;
@@ -47,9 +47,9 @@ export interface ChatLauncherProps {
47
47
  /**
48
48
  * How the docked panel sits on the page. `raised` (the default) is a glass
49
49
  * card with the floating shadow, inset by `--ds-chat-inset`. `inset` is
50
- * flat: the app surface colour, no shadow, border or blur, and the
51
- * `--ds-shell-inset` gap, so it matches AppLayout's `inset` content
52
- * surface beside it. The overlay below the dock threshold takes the same
50
+ * AppLayout's `inset` content surface beside it, solid on the app surface
51
+ * colour with the same raised edge (the hairline and the floating
52
+ * shadow), no blur, and the `--ds-shell-inset` gap. The overlay below the dock threshold takes the same
53
53
  * gap but keeps its shadow, since it still covers the page; the floating
54
54
  * card and the takeover keep their own look.
55
55
  */