@vvedantb/ui 0.62.1 → 0.63.1
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/SidePanelTabs.js +7 -5
- 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 +2 -2
- 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/client.js +1 -1
- package/dist/src/generative-ui/content.js +3 -3
- package/dist/src/generative-ui/layout.js +1 -1
- package/dist/src/index.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/motion/dock-motion.js +36 -16
- 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/SidePanelTabs.tsx +7 -5
- 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 +2 -2
- 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/client.ts +1 -1
- package/src/generative-ui/content.tsx +3 -3
- package/src/generative-ui/layout.tsx +1 -1
- package/src/index.ts +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/motion/dock-motion.ts +30 -13
- 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,28 +1,23 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @vvedantb/ui/tokens/css/clear-input.css: layers for @vvedantb/ui
|
|
3
|
-
* ClearInput (`.t-clear`, clip, mirror
|
|
3
|
+
* ClearInput (`.t-clear`, clip, mirror and placeholder), the transitions.dev
|
|
4
4
|
* input clear with dissolve. tokens.css imports it.
|
|
5
5
|
*
|
|
6
6
|
* clearInputDissolve reads the variables below from `html`. Set any of them
|
|
7
7
|
* on the app `:root` to change the timing (numbers in ms or px):
|
|
8
8
|
* --clear-dur, --clear-out-dur, --clear-in-dur, --clear-out-fly,
|
|
9
|
-
* --clear-in-fly, --clear-out-ease, --clear-in-ease
|
|
10
|
-
* --glow-peak-at, --glow-opacity, --glow-spread
|
|
9
|
+
* --clear-in-fly, --clear-out-ease, --clear-in-ease
|
|
11
10
|
*/
|
|
12
11
|
|
|
13
12
|
@layer base {
|
|
14
13
|
:root {
|
|
15
|
-
--clear-dur:
|
|
14
|
+
--clear-dur: 400ms;
|
|
16
15
|
--clear-out-dur: 400ms;
|
|
17
16
|
--clear-in-dur: 400ms;
|
|
18
17
|
--clear-out-fly: 12px;
|
|
19
18
|
--clear-in-fly: 12px;
|
|
20
19
|
--clear-out-ease: cubic-bezier(0.22, 1, 0.36, 1);
|
|
21
20
|
--clear-in-ease: cubic-bezier(0.22, 1, 0.36, 1);
|
|
22
|
-
--glow-delay: 50ms;
|
|
23
|
-
--glow-peak-at: 0.15;
|
|
24
|
-
--glow-opacity: 0.85;
|
|
25
|
-
--glow-spread: 1.5;
|
|
26
21
|
}
|
|
27
22
|
}
|
|
28
23
|
|
|
@@ -38,8 +33,7 @@
|
|
|
38
33
|
}
|
|
39
34
|
.t-clear-clip,
|
|
40
35
|
.t-clear-mirror,
|
|
41
|
-
.t-clear-placeholder
|
|
42
|
-
.t-clear-glow {
|
|
36
|
+
.t-clear-placeholder {
|
|
43
37
|
position: absolute;
|
|
44
38
|
inset: 0;
|
|
45
39
|
pointer-events: none;
|
|
@@ -70,13 +64,4 @@
|
|
|
70
64
|
.t-clear.is-clearing > input {
|
|
71
65
|
-webkit-text-fill-color: transparent;
|
|
72
66
|
}
|
|
73
|
-
.t-clear-glow {
|
|
74
|
-
opacity: 0;
|
|
75
|
-
z-index: 3;
|
|
76
|
-
mix-blend-mode: multiply;
|
|
77
|
-
}
|
|
78
|
-
.dark .t-clear-glow,
|
|
79
|
-
[data-theme="dark"] .t-clear-glow {
|
|
80
|
-
mix-blend-mode: screen;
|
|
81
|
-
}
|
|
82
67
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vvedantb/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.63.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Shared React 19 UI for web apps: one main JavaScript entry (primitives, shell pieces, app helpers including the Convex and Clerk provider, VITE env parsing and ensure-user, artifact viewers over the @vvedantb/server artifacts core, native tokens), third-party brand logos (also @vvedantb/ui/logos), motion-driven animated SVG icons (@vvedantb/ui/icons/animated), a client entry without @vvedantb/server, convex or Clerk for Chrome extensions, design-token CSS, shared Tailwind v4 CSS, a Tailwind preset and packaged Instrument Sans fonts.",
|
|
6
6
|
"type": "module",
|
|
@@ -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
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
type ReactNode,
|
|
8
8
|
type RefObject,
|
|
9
9
|
} from "react";
|
|
10
|
-
import {
|
|
10
|
+
import { dockPopIn, dockPopOut, dockSwitch } from "../../src/motion/dock-motion";
|
|
11
11
|
import { Tabs, TabsList, TabsTrigger } from "../../src/ui/tabs";
|
|
12
12
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../../src/ui/tooltip";
|
|
13
13
|
import { cn } from "../../src/utils/cn";
|
|
@@ -47,8 +47,8 @@ export function popOutSidePanel(root: HTMLElement | null, collapse: () => void)
|
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Keeps the card's arrow level with the active rail tab, and plays the card's
|
|
50
|
-
* dock motion: pop in when the card appears, a
|
|
51
|
-
* changes. It writes the transform straight to the node (no React state), as
|
|
50
|
+
* dock motion: pop in when the card appears, a content slide when the active
|
|
51
|
+
* tab changes. It writes the transform straight to the node (no React state), as
|
|
52
52
|
* the tab pill does: the first placement snaps, later moves slide. The arrow
|
|
53
53
|
* hides when the active tab is scrolled out of the card's height. Measure
|
|
54
54
|
* before animating: a scaled card reports a scaled rect.
|
|
@@ -74,6 +74,7 @@ function useActiveTabArrow(
|
|
|
74
74
|
const open = c.width > 0;
|
|
75
75
|
const opened = open && !wasOpen;
|
|
76
76
|
const switched = open && wasOpen && tab !== null && tab !== lastTab;
|
|
77
|
+
const previousTab = lastTab;
|
|
77
78
|
wasOpen = open;
|
|
78
79
|
if (tab) lastTab = tab;
|
|
79
80
|
if (!tab || !open) {
|
|
@@ -98,7 +99,7 @@ function useActiveTabArrow(
|
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
101
|
if (opened) dockPopIn(card, tab, "right", arrow);
|
|
101
|
-
else if (switched)
|
|
102
|
+
else if (switched) dockSwitch(card, previousTab, tab);
|
|
102
103
|
};
|
|
103
104
|
sync();
|
|
104
105
|
if (typeof ResizeObserver === "undefined") return;
|
|
@@ -141,7 +142,8 @@ export type SidePanelTabsFrameProps = {
|
|
|
141
142
|
* edge, the content a rounded card beside it with an arrow that points at the
|
|
142
143
|
* active tab; `collapsed` hides the card and the rail stays. Below `md`: a
|
|
143
144
|
* column, the tab strip on top and the content edge to edge. The card pops
|
|
144
|
-
* out of the active tab when it opens
|
|
145
|
+
* out of the active tab when it opens; on a tab switch its content slides in
|
|
146
|
+
* from the side of the new tab; close it
|
|
145
147
|
* through `popOutSidePanel`.
|
|
146
148
|
*/
|
|
147
149
|
function Frame({ collapsed = false, rail, children, className, cardClassName, arrowClassName }: SidePanelTabsFrameProps) {
|
|
@@ -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
|