@vvedantb/ui 0.63.0 → 0.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/src/settings/SettingsPage.tsx +1 -1
- package/app/src/settings/SettingsSection.tsx +1 -1
- package/app/src/settings/ThemeModePicker.tsx +10 -2
- package/dist/app/src/settings/SettingsPage.js +1 -1
- package/dist/app/src/settings/SettingsSection.js +1 -1
- package/dist/app/src/settings/ThemeModePicker.js +11 -5
- package/dist/shell/src/PageHeaderBar.js +391 -175
- package/dist/shell/src/PageWrapper.js +159 -103
- package/dist/shell/src/SidebarChrome.js +1 -1
- package/dist/shell/src/SidebarPanel.js +1 -1
- package/dist/shell/src/SidebarResize.js +2 -2
- package/dist/shell/src/SidebarUpgradeCard.js +1 -1
- package/dist/shell/src/app-shell-classes.js +1 -1
- package/dist/src/ai-elements/activity-question.js +78 -39
- package/dist/src/ai-elements/message.js +2 -2
- package/dist/src/ai-elements/model-picker-content.js +1 -1
- package/dist/src/ai-elements/model-picker.js +1 -1
- package/dist/src/ai-elements/prompt-input.js +1 -1
- package/dist/src/generative-ui/content.js +3 -3
- package/dist/src/generative-ui/layout.js +1 -1
- package/dist/src/kibo/kanban.js +1 -1
- package/dist/src/kibo/list.js +1 -1
- package/dist/src/kibo/video-player.js +0 -1
- package/dist/src/marketing/ProductHeroOrbit.js +26 -32
- package/dist/src/marketing/createLandingKit.js +1 -1
- package/dist/src/marketing/landing.js +1 -1
- package/dist/src/ui/_menu-classes.alt.js +1 -1
- package/dist/src/ui/_menu-classes.js +1 -1
- package/dist/src/ui/bulk-action-bar.js +1 -1
- package/dist/src/ui/calendar.js +1 -1
- package/dist/src/ui/card.js +1 -1
- package/dist/src/ui/clear-input.js +33 -46
- package/dist/src/ui/clearInputDissolve.js +2 -57
- package/dist/src/ui/command.js +3 -3
- package/dist/src/ui/count-pop.js +1 -1
- package/dist/src/ui/dialog.js +1 -1
- package/dist/src/ui/media-preview.js +1 -1
- package/dist/src/ui/progress.js +1 -1
- package/dist/src/ui/radix-select.js +1 -1
- package/dist/src/ui/select.js +1 -1
- package/dist/src/ui/table.js +1 -1
- package/dist/tokens/src/css/clear-input.css +4 -19
- package/package.json +1 -1
- package/shell/src/PageHeaderBar.tsx +162 -21
- package/shell/src/PageWrapper.tsx +116 -33
- package/shell/src/SidebarChrome.tsx +1 -1
- package/shell/src/SidebarPanel.tsx +1 -1
- package/shell/src/SidebarResize.tsx +2 -2
- package/shell/src/SidebarUpgradeCard.tsx +1 -1
- package/shell/src/app-shell-classes.ts +1 -1
- package/src/ai-elements/activity-question.tsx +23 -5
- package/src/ai-elements/message.tsx +3 -3
- package/src/ai-elements/model-picker-content.tsx +1 -1
- package/src/ai-elements/model-picker.tsx +1 -1
- package/src/ai-elements/prompt-input.tsx +1 -1
- package/src/generative-ui/content.tsx +3 -3
- package/src/generative-ui/layout.tsx +1 -1
- package/src/kibo/kanban.tsx +1 -1
- package/src/kibo/list.tsx +1 -1
- package/src/kibo/video-player.tsx +0 -2
- package/src/marketing/ProductHeroOrbit.tsx +3 -4
- package/src/marketing/createLandingKit.tsx +1 -1
- package/src/marketing/landing.tsx +1 -1
- package/src/ui/_menu-classes.alt.ts +1 -1
- package/src/ui/_menu-classes.ts +1 -1
- package/src/ui/bulk-action-bar.tsx +1 -1
- package/src/ui/calendar.tsx +1 -1
- package/src/ui/card.tsx +1 -1
- package/src/ui/clear-input.tsx +1 -5
- package/src/ui/clearInputDissolve.ts +2 -85
- package/src/ui/command.tsx +3 -3
- package/src/ui/count-pop.tsx +1 -1
- package/src/ui/dialog.tsx +1 -1
- package/src/ui/media-preview.tsx +1 -1
- package/src/ui/progress.tsx +1 -1
- package/src/ui/radix-select.tsx +1 -1
- package/src/ui/select.tsx +1 -1
- package/src/ui/table.tsx +1 -1
- package/tokens/examples/tokens-moved/Fixture.tsx +1 -1
- package/tokens/src/css/clear-input.css +4 -19
|
@@ -1,8 +1,55 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import { IconArrowLeft } from "@tabler/icons-react";
|
|
3
|
+
import { LazyMotion, domMax, m } from "motion/react";
|
|
3
4
|
import { Button } from "../../src/ui/button";
|
|
4
5
|
import { useMediaQuery } from "../../src/hooks/use-media-query";
|
|
6
|
+
import { pageTitleClass } from "../../src/ui/page-title";
|
|
5
7
|
import { cn } from "../../src/utils/cn";
|
|
8
|
+
import { motionDuration, motionEase } from "../../src/motion/presets";
|
|
9
|
+
|
|
10
|
+
const slotTransition = {
|
|
11
|
+
duration: motionDuration.fast,
|
|
12
|
+
ease: motionEase,
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
type SlotProps = {
|
|
16
|
+
/** When `false` the slot renders as a plain element. */
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
/** Seconds before the slot enters. */
|
|
19
|
+
delay?: number;
|
|
20
|
+
className?: string;
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** A header slot that fades and lifts in. Needs an ancestor `LazyMotion`. */
|
|
25
|
+
function Slot({ enabled, delay = 0, className, children }: SlotProps) {
|
|
26
|
+
if (!enabled) return <div className={className}>{children}</div>;
|
|
27
|
+
return (
|
|
28
|
+
<m.div
|
|
29
|
+
className={className}
|
|
30
|
+
initial={{ opacity: 0, y: 6 }}
|
|
31
|
+
animate={{ opacity: 1, y: 0 }}
|
|
32
|
+
transition={{ ...slotTransition, delay }}
|
|
33
|
+
>
|
|
34
|
+
{children}
|
|
35
|
+
</m.div>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** The `h1` counterpart of `Slot`. */
|
|
40
|
+
function TitleSlot({ enabled, className, children }: SlotProps) {
|
|
41
|
+
if (!enabled) return <h1 className={className}>{children}</h1>;
|
|
42
|
+
return (
|
|
43
|
+
<m.h1
|
|
44
|
+
className={className}
|
|
45
|
+
initial={{ opacity: 0, y: 6 }}
|
|
46
|
+
animate={{ opacity: 1, y: 0 }}
|
|
47
|
+
transition={slotTransition}
|
|
48
|
+
>
|
|
49
|
+
{children}
|
|
50
|
+
</m.h1>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
6
53
|
|
|
7
54
|
export type PageHeaderBarProps = {
|
|
8
55
|
title?: ReactNode;
|
|
@@ -12,6 +59,13 @@ export type PageHeaderBarProps = {
|
|
|
12
59
|
* Centred over the title row at `sm`+; below that it takes its own row.
|
|
13
60
|
*/
|
|
14
61
|
titleAfter?: ReactNode;
|
|
62
|
+
/**
|
|
63
|
+
* Sits in the title row right after the title (or back button), without
|
|
64
|
+
* shrinking. Unlike `titleAfter` it is never centred over the row. Works in
|
|
65
|
+
* both layouts: in `"stacked"` the title and `leftSection` share one row above
|
|
66
|
+
* `description`.
|
|
67
|
+
*/
|
|
68
|
+
leftSection?: ReactNode;
|
|
15
69
|
/** Centred middle slot, shown with `headerColumns="three-at-md"`. */
|
|
16
70
|
headerCenter?: ReactNode;
|
|
17
71
|
/** Right-aligned action cluster. */
|
|
@@ -26,11 +80,35 @@ export type PageHeaderBarProps = {
|
|
|
26
80
|
insetHeader?: boolean;
|
|
27
81
|
/** Centre the content in a `max-w-5xl` column with roomier padding. */
|
|
28
82
|
comfortable?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Centre the header and toolbar in a `max-w-5xl` column. Unlike
|
|
85
|
+
* `comfortable` it keeps the default `p-3 sm:px-4` padding.
|
|
86
|
+
*/
|
|
87
|
+
contentMaxWidth?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Title size. `"auto"` (default): the page title standard when stacked,
|
|
90
|
+
* responsive sizes when inline. `"page"`: the page title standard in either
|
|
91
|
+
* layout, with a string title shown from `md` up.
|
|
92
|
+
*/
|
|
93
|
+
titleScale?: "auto" | "page";
|
|
29
94
|
/** Back button at the start of the title row (inline layout only). */
|
|
30
95
|
showBack?: boolean;
|
|
31
96
|
onBack?: () => void;
|
|
32
97
|
/** Entry + `motion-base` animations. Opt-in so the package needs no animation plugin. */
|
|
33
98
|
animated?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Fade and lift the title block, `leftSection`, `headerCenter` (delay 0.06 s)
|
|
101
|
+
* and `headerRight` (delay 0.1 s) in with `motion/react`. Default `false`.
|
|
102
|
+
* Needs the app's `MotionProvider`, which sets reduced motion. Replaces the
|
|
103
|
+
* CSS `animated` entry on those slots. The toolbar and tabs stay still.
|
|
104
|
+
*/
|
|
105
|
+
headerMotion?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Give the title row grid a `min-h-10` (40 px), so the title, back button and
|
|
108
|
+
* actions centre in a row that is at least as tall as a `h-10` control, even
|
|
109
|
+
* when the row holds only a title. Default `false`.
|
|
110
|
+
*/
|
|
111
|
+
titleRowMinHeight?: boolean;
|
|
34
112
|
/**
|
|
35
113
|
* `"stacked"` (default): fixed `text-xl` title over an optional `description`;
|
|
36
114
|
* a string title is hidden below `md`. `"inline"`: responsive title in a row
|
|
@@ -48,6 +126,10 @@ export type PageHeaderBarProps = {
|
|
|
48
126
|
renderMobileActions?: (node: ReactNode) => ReactNode;
|
|
49
127
|
/** Supply `useIsDesktop()`; pairs with `renderMobileActions`. */
|
|
50
128
|
isDesktop?: boolean;
|
|
129
|
+
/** Render nothing. For a page with no title, actions, toolbar or tabs. */
|
|
130
|
+
hideHeader?: boolean;
|
|
131
|
+
/** Hide the whole header block below `md` (it shows from `md` up). */
|
|
132
|
+
hideHeaderOnMobile?: boolean;
|
|
51
133
|
};
|
|
52
134
|
|
|
53
135
|
/**
|
|
@@ -60,6 +142,7 @@ export type PageHeaderBarProps = {
|
|
|
60
142
|
export function PageHeaderBar({
|
|
61
143
|
title,
|
|
62
144
|
titleAfter,
|
|
145
|
+
leftSection,
|
|
63
146
|
headerCenter,
|
|
64
147
|
headerRight,
|
|
65
148
|
toolbar,
|
|
@@ -67,18 +150,26 @@ export function PageHeaderBar({
|
|
|
67
150
|
description,
|
|
68
151
|
insetHeader = false,
|
|
69
152
|
comfortable = false,
|
|
153
|
+
contentMaxWidth = false,
|
|
154
|
+
titleScale = "auto",
|
|
70
155
|
showBack = false,
|
|
71
156
|
onBack,
|
|
72
157
|
animated = false,
|
|
158
|
+
headerMotion = false,
|
|
159
|
+
titleRowMinHeight = false,
|
|
73
160
|
titleLayout = "stacked",
|
|
74
161
|
headerColumns = "two",
|
|
75
162
|
renderMobileActions,
|
|
76
163
|
isDesktop,
|
|
164
|
+
hideHeader = false,
|
|
165
|
+
hideHeaderOnMobile = false,
|
|
77
166
|
}: PageHeaderBarProps) {
|
|
78
167
|
const isStringTitle = typeof title === "string";
|
|
79
168
|
const hasToolbar = toolbar != null;
|
|
80
169
|
const hasTabs = tabs != null;
|
|
81
170
|
const inline = titleLayout === "inline";
|
|
171
|
+
const maxWidth = comfortable || contentMaxWidth;
|
|
172
|
+
const responsiveTitle = inline && titleScale === "auto";
|
|
82
173
|
const threeCol = headerColumns === "three-at-md";
|
|
83
174
|
|
|
84
175
|
// Below `sm` the title row cannot hold a second control, so `titleAfter`
|
|
@@ -91,22 +182,29 @@ export function PageHeaderBar({
|
|
|
91
182
|
renderMobileActions != null && isStringTitle && isDesktop === false;
|
|
92
183
|
const headerRightInPage = headerRight != null && !headerRightInTopBar;
|
|
93
184
|
const hideOnMobile =
|
|
94
|
-
|
|
185
|
+
hideHeaderOnMobile ||
|
|
186
|
+
(renderMobileActions != null && isStringTitle && !hasToolbar && !hasTabs);
|
|
95
187
|
|
|
96
188
|
const titleClass = cn(
|
|
97
189
|
"min-w-0 text-foreground",
|
|
98
|
-
|
|
190
|
+
responsiveTitle
|
|
99
191
|
? "text-base font-semibold tracking-[-0.02em] sm:text-lg md:text-xl"
|
|
100
|
-
:
|
|
101
|
-
animated &&
|
|
192
|
+
: pageTitleClass,
|
|
193
|
+
animated &&
|
|
194
|
+
!headerMotion &&
|
|
195
|
+
"animate-in fade-in slide-in-from-left-1 duration-200",
|
|
102
196
|
isStringTitle
|
|
103
|
-
?
|
|
197
|
+
? responsiveTitle
|
|
104
198
|
? "hidden whitespace-nowrap text-balance lg:block"
|
|
105
199
|
: "hidden text-balance whitespace-nowrap md:block"
|
|
106
200
|
: "overflow-hidden",
|
|
107
201
|
);
|
|
108
202
|
|
|
109
|
-
return
|
|
203
|
+
if (hideHeader) return null;
|
|
204
|
+
|
|
205
|
+
const cssSlotMotion = animated && !headerMotion;
|
|
206
|
+
|
|
207
|
+
const bar = (
|
|
110
208
|
<>
|
|
111
209
|
{headerRightInTopBar && renderMobileActions
|
|
112
210
|
? renderMobileActions(headerRight)
|
|
@@ -122,12 +220,13 @@ export function PageHeaderBar({
|
|
|
122
220
|
<div
|
|
123
221
|
className={cn(
|
|
124
222
|
"relative grid items-center gap-2 sm:gap-3",
|
|
223
|
+
titleRowMinHeight && "min-h-10",
|
|
125
224
|
headerRightInPage
|
|
126
225
|
? threeCol
|
|
127
226
|
? "grid-cols-[minmax(0,1fr)_minmax(0,auto)] md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)]"
|
|
128
227
|
: "grid-cols-[minmax(0,1fr)_minmax(0,auto)]"
|
|
129
228
|
: "grid-cols-1",
|
|
130
|
-
|
|
229
|
+
maxWidth && "mx-auto w-full max-w-5xl",
|
|
131
230
|
insetHeader && "px-4",
|
|
132
231
|
)}
|
|
133
232
|
>
|
|
@@ -153,7 +252,8 @@ export function PageHeaderBar({
|
|
|
153
252
|
</Button>
|
|
154
253
|
) : null}
|
|
155
254
|
{title ? (
|
|
156
|
-
<
|
|
255
|
+
<TitleSlot
|
|
256
|
+
enabled={headerMotion}
|
|
157
257
|
className={cn(
|
|
158
258
|
"flex-1",
|
|
159
259
|
titleAfterInline && "sm:max-w-[calc(75%-4rem)]",
|
|
@@ -161,7 +261,12 @@ export function PageHeaderBar({
|
|
|
161
261
|
)}
|
|
162
262
|
>
|
|
163
263
|
{title}
|
|
164
|
-
</
|
|
264
|
+
</TitleSlot>
|
|
265
|
+
) : null}
|
|
266
|
+
{leftSection != null ? (
|
|
267
|
+
<Slot enabled={headerMotion} className="shrink-0">
|
|
268
|
+
{leftSection}
|
|
269
|
+
</Slot>
|
|
165
270
|
) : null}
|
|
166
271
|
{titleAfterInline ? (
|
|
167
272
|
<div className="shrink-0 sm:absolute sm:left-1/2 sm:top-1/2 sm:-translate-x-1/2 sm:-translate-y-1/2">
|
|
@@ -170,8 +275,34 @@ export function PageHeaderBar({
|
|
|
170
275
|
) : null}
|
|
171
276
|
</div>
|
|
172
277
|
) : (
|
|
173
|
-
<div
|
|
174
|
-
|
|
278
|
+
<div
|
|
279
|
+
className={cn(
|
|
280
|
+
"flex min-w-0 flex-col gap-1",
|
|
281
|
+
threeCol &&
|
|
282
|
+
headerRightInPage &&
|
|
283
|
+
!headerCenter &&
|
|
284
|
+
"md:col-span-2",
|
|
285
|
+
)}
|
|
286
|
+
>
|
|
287
|
+
{leftSection != null ? (
|
|
288
|
+
<div className="flex min-w-0 items-center gap-2 sm:gap-3">
|
|
289
|
+
{title ? (
|
|
290
|
+
<TitleSlot
|
|
291
|
+
enabled={headerMotion}
|
|
292
|
+
className={cn("flex-1", titleClass)}
|
|
293
|
+
>
|
|
294
|
+
{title}
|
|
295
|
+
</TitleSlot>
|
|
296
|
+
) : null}
|
|
297
|
+
<Slot enabled={headerMotion} className="shrink-0">
|
|
298
|
+
{leftSection}
|
|
299
|
+
</Slot>
|
|
300
|
+
</div>
|
|
301
|
+
) : title ? (
|
|
302
|
+
<TitleSlot enabled={headerMotion} className={titleClass}>
|
|
303
|
+
{title}
|
|
304
|
+
</TitleSlot>
|
|
305
|
+
) : null}
|
|
175
306
|
{description ? (
|
|
176
307
|
<p className="hidden text-sm text-muted-foreground md:block">
|
|
177
308
|
{description}
|
|
@@ -180,24 +311,29 @@ export function PageHeaderBar({
|
|
|
180
311
|
</div>
|
|
181
312
|
)}
|
|
182
313
|
{headerCenter ? (
|
|
183
|
-
<
|
|
314
|
+
<Slot
|
|
315
|
+
enabled={headerMotion}
|
|
316
|
+
delay={0.06}
|
|
184
317
|
className={cn(
|
|
185
318
|
"hidden min-w-0 justify-center md:flex",
|
|
186
|
-
|
|
319
|
+
cssSlotMotion && "animate-in fade-in duration-200",
|
|
187
320
|
)}
|
|
188
321
|
>
|
|
189
322
|
<div className="w-full max-w-xl">{headerCenter}</div>
|
|
190
|
-
</
|
|
323
|
+
</Slot>
|
|
191
324
|
) : null}
|
|
192
325
|
{headerRightInPage ? (
|
|
193
|
-
<
|
|
326
|
+
<Slot
|
|
327
|
+
enabled={headerMotion}
|
|
328
|
+
delay={0.1}
|
|
194
329
|
className={cn(
|
|
195
330
|
"flex min-h-10 max-sm:min-w-0 max-sm:flex-wrap items-center justify-end gap-1.5 sm:gap-2 justify-self-end",
|
|
196
|
-
|
|
331
|
+
cssSlotMotion &&
|
|
332
|
+
"animate-in fade-in slide-in-from-right-1 duration-200",
|
|
197
333
|
)}
|
|
198
334
|
>
|
|
199
335
|
{headerRight}
|
|
200
|
-
</
|
|
336
|
+
</Slot>
|
|
201
337
|
) : null}
|
|
202
338
|
</div>
|
|
203
339
|
{titleAfterOwnRow ? (
|
|
@@ -206,20 +342,23 @@ export function PageHeaderBar({
|
|
|
206
342
|
</div>
|
|
207
343
|
) : null}
|
|
208
344
|
{headerCenter ? (
|
|
209
|
-
<
|
|
345
|
+
<Slot
|
|
346
|
+
enabled={headerMotion}
|
|
347
|
+
delay={0.06}
|
|
210
348
|
className={cn(
|
|
211
349
|
"mt-2 md:hidden",
|
|
212
|
-
|
|
350
|
+
cssSlotMotion && "animate-in fade-in duration-200",
|
|
213
351
|
)}
|
|
214
352
|
>
|
|
215
353
|
{headerCenter}
|
|
216
|
-
</
|
|
354
|
+
</Slot>
|
|
217
355
|
) : null}
|
|
218
356
|
{hasToolbar || hasTabs ? (
|
|
219
357
|
<div
|
|
220
358
|
className={cn(
|
|
221
359
|
"mt-3 space-y-3",
|
|
222
|
-
|
|
360
|
+
maxWidth && "mx-auto w-full max-w-5xl",
|
|
361
|
+
insetHeader && "px-4",
|
|
223
362
|
)}
|
|
224
363
|
>
|
|
225
364
|
{hasToolbar ? (
|
|
@@ -237,4 +376,6 @@ export function PageHeaderBar({
|
|
|
237
376
|
</div>
|
|
238
377
|
</>
|
|
239
378
|
);
|
|
379
|
+
|
|
380
|
+
return headerMotion ? <LazyMotion features={domMax}>{bar}</LazyMotion> : bar;
|
|
240
381
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
+
import { LazyMotion, domMax, m } from "motion/react";
|
|
2
3
|
import { PageHeaderBar, type PageHeaderBarProps } from "./PageHeaderBar";
|
|
3
4
|
import { cn } from "../../src/utils/cn";
|
|
5
|
+
import {
|
|
6
|
+
motionDistance,
|
|
7
|
+
motionDuration,
|
|
8
|
+
motionEase,
|
|
9
|
+
} from "../../src/motion/presets";
|
|
4
10
|
|
|
5
11
|
export type PageWrapperProps = PageHeaderBarProps & {
|
|
6
12
|
children: ReactNode;
|
|
@@ -12,8 +18,31 @@ export type PageWrapperProps = PageHeaderBarProps & {
|
|
|
12
18
|
fillHeight?: boolean;
|
|
13
19
|
/** Pad the body with the page gutter. Default `true`. */
|
|
14
20
|
childPadding?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Add the themed scrollbar chrome to the scrolling body (non-`fillHeight`).
|
|
23
|
+
* `true`: `scrollbar`. `"thin"`: `scrollbar-thin`.
|
|
24
|
+
*/
|
|
25
|
+
bodyScrollbar?: boolean | "thin";
|
|
26
|
+
/**
|
|
27
|
+
* `"owned"` (default): a full-height shell; the body scrolls or fills.
|
|
28
|
+
* `"unbounded"`: no height ownership. The page is the header over the padded
|
|
29
|
+
* children and the parent scrolls. `fillHeight`, `scrollRef`, `bodyMotion`
|
|
30
|
+
* and `bodyScrollbar` have no effect.
|
|
31
|
+
*/
|
|
32
|
+
scrollMode?: "owned" | "unbounded";
|
|
33
|
+
/** Ref callback for the scrolling body (virtualised lists). `"owned"` only. */
|
|
34
|
+
scrollRef?: (el: HTMLDivElement | null) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Fade and lift the body in with `motion/react` (`motionDuration.base`,
|
|
37
|
+
* delayed 0.12 s). Default `false`. Separate from the CSS `animated` prop.
|
|
38
|
+
*/
|
|
39
|
+
bodyMotion?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Classes for the padded content box. Merged after the defaults, so a class
|
|
42
|
+
* such as `gap-8` replaces `gap-4`. Pair `childPadding={false}` with your own
|
|
43
|
+
* padding classes here.
|
|
44
|
+
*/
|
|
45
|
+
bodyClassName?: string;
|
|
17
46
|
};
|
|
18
47
|
|
|
19
48
|
/**
|
|
@@ -27,51 +56,105 @@ export function PageWrapper({
|
|
|
27
56
|
fillHeight = false,
|
|
28
57
|
childPadding = true,
|
|
29
58
|
bodyScrollbar = false,
|
|
59
|
+
scrollMode = "owned",
|
|
60
|
+
scrollRef,
|
|
61
|
+
bodyMotion = false,
|
|
62
|
+
bodyClassName,
|
|
30
63
|
...header
|
|
31
64
|
}: PageWrapperProps) {
|
|
32
|
-
const { comfortable = false, animated = false } =
|
|
65
|
+
const { comfortable = false, contentMaxWidth = false, animated = false } =
|
|
66
|
+
header;
|
|
33
67
|
|
|
34
|
-
|
|
68
|
+
const content = comfortable || contentMaxWidth ? (
|
|
35
69
|
<div
|
|
36
70
|
className={cn(
|
|
37
|
-
"
|
|
38
|
-
|
|
71
|
+
"mx-auto w-full max-w-5xl",
|
|
72
|
+
scrollMode === "owned" && fillHeight && "flex min-h-0 flex-1 flex-col",
|
|
39
73
|
)}
|
|
40
74
|
>
|
|
41
|
-
|
|
75
|
+
{children}
|
|
76
|
+
</div>
|
|
77
|
+
) : (
|
|
78
|
+
children
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
if (scrollMode === "unbounded") {
|
|
82
|
+
return (
|
|
83
|
+
<div>
|
|
42
84
|
<PageHeaderBar {...header} />
|
|
43
85
|
<div
|
|
44
86
|
className={cn(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
87
|
+
childPadding &&
|
|
88
|
+
(comfortable
|
|
89
|
+
? "px-4 pb-8 pt-0 sm:px-6"
|
|
90
|
+
: "px-3 pb-6 pt-0 sm:px-4"),
|
|
91
|
+
bodyClassName,
|
|
49
92
|
)}
|
|
50
93
|
>
|
|
51
|
-
|
|
52
|
-
className={cn(
|
|
53
|
-
"flex flex-col gap-4",
|
|
54
|
-
animated && "animate-in fade-in slide-in-from-bottom-1 duration-300",
|
|
55
|
-
childPadding &&
|
|
56
|
-
(comfortable ? "p-4 pt-0 sm:px-6" : "p-3 pt-0 sm:px-4"),
|
|
57
|
-
fillHeight ? "min-h-0 flex-1 overflow-hidden" : "min-h-full",
|
|
58
|
-
)}
|
|
59
|
-
>
|
|
60
|
-
{comfortable ? (
|
|
61
|
-
<div
|
|
62
|
-
className={cn(
|
|
63
|
-
"mx-auto w-full max-w-5xl",
|
|
64
|
-
fillHeight && "flex min-h-0 flex-1 flex-col",
|
|
65
|
-
)}
|
|
66
|
-
>
|
|
67
|
-
{children}
|
|
68
|
-
</div>
|
|
69
|
-
) : (
|
|
70
|
-
children
|
|
71
|
-
)}
|
|
72
|
-
</div>
|
|
94
|
+
{content}
|
|
73
95
|
</div>
|
|
74
96
|
</div>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const bodyClass = cn(
|
|
101
|
+
"min-h-0 flex-1",
|
|
102
|
+
fillHeight
|
|
103
|
+
? "flex flex-col overflow-hidden"
|
|
104
|
+
: cn(
|
|
105
|
+
bodyScrollbar === "thin" ? "overflow-y-auto" : "overflow-auto",
|
|
106
|
+
bodyScrollbar === "thin"
|
|
107
|
+
? "scrollbar-thin"
|
|
108
|
+
: bodyScrollbar && "scrollbar",
|
|
109
|
+
),
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const inner = (
|
|
113
|
+
<div
|
|
114
|
+
className={cn(
|
|
115
|
+
"flex flex-col gap-4",
|
|
116
|
+
animated && "animate-in fade-in slide-in-from-bottom-1 duration-200",
|
|
117
|
+
childPadding &&
|
|
118
|
+
(comfortable ? "p-4 pt-0 sm:px-6" : "p-3 pt-0 sm:px-4"),
|
|
119
|
+
fillHeight ? "min-h-0 flex-1 overflow-hidden" : "min-h-full",
|
|
120
|
+
bodyClassName,
|
|
121
|
+
)}
|
|
122
|
+
>
|
|
123
|
+
{content}
|
|
124
|
+
</div>
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<div
|
|
129
|
+
className={cn(
|
|
130
|
+
"h-full min-h-0 flex-1 overflow-hidden",
|
|
131
|
+
animated && "animate-in fade-in duration-200",
|
|
132
|
+
)}
|
|
133
|
+
>
|
|
134
|
+
<div className="flex h-full min-h-0 flex-col overflow-hidden">
|
|
135
|
+
<PageHeaderBar {...header} />
|
|
136
|
+
{bodyMotion ? (
|
|
137
|
+
<LazyMotion features={domMax}>
|
|
138
|
+
<m.div
|
|
139
|
+
ref={scrollRef}
|
|
140
|
+
className={bodyClass}
|
|
141
|
+
initial={{ opacity: 0, y: motionDistance.pageY }}
|
|
142
|
+
animate={{ opacity: 1, y: 0 }}
|
|
143
|
+
transition={{
|
|
144
|
+
duration: motionDuration.base,
|
|
145
|
+
ease: motionEase,
|
|
146
|
+
delay: 0.12,
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
149
|
+
{inner}
|
|
150
|
+
</m.div>
|
|
151
|
+
</LazyMotion>
|
|
152
|
+
) : (
|
|
153
|
+
<div ref={scrollRef} className={bodyClass}>
|
|
154
|
+
{inner}
|
|
155
|
+
</div>
|
|
156
|
+
)}
|
|
157
|
+
</div>
|
|
75
158
|
</div>
|
|
76
159
|
);
|
|
77
160
|
}
|
|
@@ -156,7 +156,7 @@ function MobileTitle({ className, children, ...props }: SidebarMobileTitleProps)
|
|
|
156
156
|
<h1
|
|
157
157
|
{...props}
|
|
158
158
|
className={cn(
|
|
159
|
-
"pointer-events-none min-w-0 truncate text-center text-base font-
|
|
159
|
+
"pointer-events-none min-w-0 truncate text-center text-base font-medium leading-tight tracking-tight text-foreground",
|
|
160
160
|
className,
|
|
161
161
|
)}
|
|
162
162
|
>
|
|
@@ -109,7 +109,7 @@ export function PanelTitle({ className, ...props }: SidebarPanelTitleProps) {
|
|
|
109
109
|
<h2
|
|
110
110
|
{...props}
|
|
111
111
|
className={cn(
|
|
112
|
-
"min-w-0 flex-1 truncate text-left text-base font-
|
|
112
|
+
"min-w-0 flex-1 truncate text-left text-base font-medium leading-none tracking-tight text-foreground",
|
|
113
113
|
className,
|
|
114
114
|
)}
|
|
115
115
|
/>
|
|
@@ -123,8 +123,8 @@ export function useSidebarResizeState(
|
|
|
123
123
|
animRef.current?.stop();
|
|
124
124
|
animRef.current = animate(from, to, {
|
|
125
125
|
type: "spring",
|
|
126
|
-
bounce: 0
|
|
127
|
-
duration: 0.
|
|
126
|
+
bounce: 0,
|
|
127
|
+
duration: 0.25,
|
|
128
128
|
velocity,
|
|
129
129
|
onUpdate: (value) => setWidth(value),
|
|
130
130
|
});
|
|
@@ -38,7 +38,7 @@ export function SidebarUpgradeCard({ onUpgrade, collapsed = false, className }:
|
|
|
38
38
|
className,
|
|
39
39
|
)}
|
|
40
40
|
>
|
|
41
|
-
<span className="min-w-0 truncate text-sm font-
|
|
41
|
+
<span className="min-w-0 truncate text-sm font-medium">Upgrade to Pro</span>
|
|
42
42
|
<Button type="button" size="sm" onClick={onUpgrade} className={cn("shrink-0 rounded-full", pillClass)}>
|
|
43
43
|
Upgrade
|
|
44
44
|
</Button>
|
|
@@ -41,7 +41,7 @@ export const railGroupClass =
|
|
|
41
41
|
export const railGroupPillClass = "t-tabs-pill rounded-lg bg-segment";
|
|
42
42
|
|
|
43
43
|
/** Count badge pinned to the bottom-right of a rail tile. */
|
|
44
|
-
export const railBadgeClass = "absolute -bottom-0.5 -right-0.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-accent px-1 text-[10px] font-
|
|
44
|
+
export const railBadgeClass = "absolute -bottom-0.5 -right-0.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-accent px-1 text-[10px] font-medium leading-none text-accent-foreground"; // check-tokens-allow: accent
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Static section label above a group of panel nav rows. `px-4` lines the text
|
|
@@ -21,7 +21,7 @@ export interface ActivityQuestionCardConfig {
|
|
|
21
21
|
const OPTION_LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
22
22
|
|
|
23
23
|
const CHIP_CLASS =
|
|
24
|
-
"mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md text-3xs font-
|
|
24
|
+
"mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md text-3xs font-medium tracking-wide";
|
|
25
25
|
|
|
26
26
|
function OptionRow({
|
|
27
27
|
chip,
|
|
@@ -79,21 +79,39 @@ function OptionRow({
|
|
|
79
79
|
* Read-only record of an AskUserQuestion prompt and the answer given. The live
|
|
80
80
|
* prompt is `MultipleChoiceQuestion` in the composer dock; this is the history
|
|
81
81
|
* left behind in the transcript once the question is answered.
|
|
82
|
+
*
|
|
83
|
+
* `headerAction` renders at the right end of the "Question" header row, for
|
|
84
|
+
* controls such as a pager when the caller shows one question at a time.
|
|
82
85
|
*/
|
|
83
86
|
export function ActivityQuestionCard({
|
|
84
87
|
questions,
|
|
85
88
|
answers,
|
|
89
|
+
headerAction,
|
|
86
90
|
}: {
|
|
87
91
|
questions: ActivityQuestion[];
|
|
88
92
|
answers?: Record<string, string>;
|
|
93
|
+
headerAction?: ReactNode;
|
|
89
94
|
}) {
|
|
95
|
+
const merge = useCn();
|
|
90
96
|
if (questions.length === 0) return null;
|
|
91
97
|
|
|
92
98
|
return (
|
|
93
99
|
<div className="rounded-surface bg-card p-3 space-y-3">
|
|
94
|
-
<div
|
|
95
|
-
|
|
96
|
-
|
|
100
|
+
<div
|
|
101
|
+
className={merge(
|
|
102
|
+
"flex items-center justify-between gap-2",
|
|
103
|
+
// The action row's 28px buttons set the height, so the header keeps
|
|
104
|
+
// clear of the question text below.
|
|
105
|
+
headerAction ? "min-h-7" : undefined,
|
|
106
|
+
)}
|
|
107
|
+
>
|
|
108
|
+
<div className="flex items-center gap-1.5 text-xs font-medium text-muted-foreground">
|
|
109
|
+
<IconMessageQuestion size={14} />
|
|
110
|
+
{questions.length > 1 ? "Questions" : "Question"}
|
|
111
|
+
</div>
|
|
112
|
+
{headerAction ? (
|
|
113
|
+
<div className="flex shrink-0 items-center gap-1">{headerAction}</div>
|
|
114
|
+
) : null}
|
|
97
115
|
</div>
|
|
98
116
|
{questions.map((question, questionIndex) => {
|
|
99
117
|
const answer = answers?.[question.question];
|
|
@@ -112,7 +130,7 @@ export function ActivityQuestionCard({
|
|
|
112
130
|
{question.header ? (
|
|
113
131
|
<Badge
|
|
114
132
|
variant="secondary"
|
|
115
|
-
className="shrink-0 text-3xs font-
|
|
133
|
+
className="shrink-0 text-3xs font-medium"
|
|
116
134
|
>
|
|
117
135
|
{question.header}
|
|
118
136
|
</Badge>
|
|
@@ -61,7 +61,7 @@ export type MessageProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
61
61
|
actions?: MessageMenuAction[];
|
|
62
62
|
/**
|
|
63
63
|
* The target of a quote click: a soft primary wash and ring. Set it back to
|
|
64
|
-
* `false` about 1.5 seconds later and it fades out (`duration-
|
|
64
|
+
* `false` about 1.5 seconds later and it fades out (`duration-200`). Sets
|
|
65
65
|
* `data-highlighted`.
|
|
66
66
|
*/
|
|
67
67
|
highlighted?: boolean;
|
|
@@ -85,7 +85,7 @@ export const Message = ({
|
|
|
85
85
|
? (classes?.user ?? "is-user ml-auto justify-end")
|
|
86
86
|
: (classes?.assistant ?? "is-assistant"),
|
|
87
87
|
highlighted !== undefined &&
|
|
88
|
-
"rounded-xl transition-[background-color,box-shadow] duration-
|
|
88
|
+
"rounded-xl transition-[background-color,box-shadow] duration-200",
|
|
89
89
|
highlighted && "bg-primary/10 ring-2 ring-primary/30",
|
|
90
90
|
className,
|
|
91
91
|
)}
|
|
@@ -229,7 +229,7 @@ export const MessageQuote = ({
|
|
|
229
229
|
const merge = useCn();
|
|
230
230
|
const body = (
|
|
231
231
|
<>
|
|
232
|
-
<span className="block truncate text-xs font-
|
|
232
|
+
<span className="block truncate text-xs font-medium opacity-70">
|
|
233
233
|
{author}
|
|
234
234
|
</span>
|
|
235
235
|
<span className="line-clamp-2 block text-sm opacity-90">{text}</span>
|
|
@@ -98,7 +98,7 @@ function InstanceIcon({
|
|
|
98
98
|
<ProviderIcon provider={instance.provider} size={size} />
|
|
99
99
|
{showBadge ? (
|
|
100
100
|
<span
|
|
101
|
-
className="pointer-events-none absolute -right-0.5 -bottom-0.5 z-10 flex h-3 min-w-3 items-center justify-center rounded-full bg-surface-secondary px-0.5 text-[7px] font-
|
|
101
|
+
className="pointer-events-none absolute -right-0.5 -bottom-0.5 z-10 flex h-3 min-w-3 items-center justify-center rounded-full bg-surface-secondary px-0.5 text-[7px] font-medium leading-none text-muted-foreground"
|
|
102
102
|
style={{
|
|
103
103
|
boxShadow: `0 0 0 1.5px ${ring}`,
|
|
104
104
|
}}
|
|
@@ -220,7 +220,7 @@ export function ModelPicker<TModel extends string>({
|
|
|
220
220
|
size={14}
|
|
221
221
|
/>
|
|
222
222
|
<span
|
|
223
|
-
className="pointer-events-none absolute -right-0.5 -bottom-0.5 z-10 flex h-3 min-w-3 items-center justify-center rounded-full bg-surface-secondary px-0.5 text-[7px] font-
|
|
223
|
+
className="pointer-events-none absolute -right-0.5 -bottom-0.5 z-10 flex h-3 min-w-3 items-center justify-center rounded-full bg-surface-secondary px-0.5 text-[7px] font-medium leading-none text-muted-foreground"
|
|
224
224
|
style={{
|
|
225
225
|
boxShadow: `0 0 0 1.5px ${config?.badgeRing?.trigger ?? "var(--color-border)"}`,
|
|
226
226
|
}}
|