@behavioral-agentic-design-system/core 0.9.1 → 0.11.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/package.json +13 -1
- package/src/app/preview/components/page.tsx +211 -1
- package/src/app/shell.tsx +20 -1
- package/src/components/home-tab.tsx +26 -26
- package/src/components/ui/aspect-ratio.tsx +11 -0
- package/src/components/ui/hover-card.tsx +103 -0
- package/src/components/ui/index.ts +3 -0
- package/src/components/ui/menubar.tsx +318 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@behavioral-agentic-design-system/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "BADS core — tokens, shadcn/ui components, and the BADS template shell (app routes, customize tab, theme hooks). Forks consume this and re-export, keeping client repos to ~30 lines of glue.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Matthew Stephens <work@matthewstephens.com> (https://github.com/matthewlarn)",
|
|
@@ -106,6 +106,7 @@
|
|
|
106
106
|
},
|
|
107
107
|
"peerDependencies": {
|
|
108
108
|
"@radix-ui/react-accordion": "*",
|
|
109
|
+
"@radix-ui/react-aspect-ratio": "*",
|
|
109
110
|
"@radix-ui/react-avatar": "*",
|
|
110
111
|
"@radix-ui/react-checkbox": "*",
|
|
111
112
|
"@radix-ui/react-collapsible": "*",
|
|
@@ -113,7 +114,9 @@
|
|
|
113
114
|
"@radix-ui/react-dialog": "*",
|
|
114
115
|
"@radix-ui/react-navigation-menu": "*",
|
|
115
116
|
"@radix-ui/react-dropdown-menu": "*",
|
|
117
|
+
"@radix-ui/react-hover-card": "*",
|
|
116
118
|
"@radix-ui/react-label": "*",
|
|
119
|
+
"@radix-ui/react-menubar": "*",
|
|
117
120
|
"@radix-ui/react-popover": "*",
|
|
118
121
|
"@radix-ui/react-progress": "*",
|
|
119
122
|
"@radix-ui/react-radio-group": "*",
|
|
@@ -141,6 +144,9 @@
|
|
|
141
144
|
"@radix-ui/react-accordion": {
|
|
142
145
|
"optional": true
|
|
143
146
|
},
|
|
147
|
+
"@radix-ui/react-aspect-ratio": {
|
|
148
|
+
"optional": true
|
|
149
|
+
},
|
|
144
150
|
"@radix-ui/react-avatar": {
|
|
145
151
|
"optional": true
|
|
146
152
|
},
|
|
@@ -162,9 +168,15 @@
|
|
|
162
168
|
"@radix-ui/react-dropdown-menu": {
|
|
163
169
|
"optional": true
|
|
164
170
|
},
|
|
171
|
+
"@radix-ui/react-hover-card": {
|
|
172
|
+
"optional": true
|
|
173
|
+
},
|
|
165
174
|
"@radix-ui/react-label": {
|
|
166
175
|
"optional": true
|
|
167
176
|
},
|
|
177
|
+
"@radix-ui/react-menubar": {
|
|
178
|
+
"optional": true
|
|
179
|
+
},
|
|
168
180
|
"@radix-ui/react-popover": {
|
|
169
181
|
"optional": true
|
|
170
182
|
},
|
|
@@ -82,6 +82,7 @@ import { PinInput } from "@behavioral-agentic-design-system/core/components/ui/p
|
|
|
82
82
|
import { NumberInput } from "@behavioral-agentic-design-system/core/components/ui/number-input";
|
|
83
83
|
import { FileUpload } from "@behavioral-agentic-design-system/core/components/ui/file-upload";
|
|
84
84
|
import { Spinner } from "@behavioral-agentic-design-system/core/components/ui/spinner";
|
|
85
|
+
import { AspectRatio } from "@behavioral-agentic-design-system/core/components/ui/aspect-ratio";
|
|
85
86
|
import {
|
|
86
87
|
ContextMenu,
|
|
87
88
|
ContextMenuTrigger,
|
|
@@ -105,7 +106,31 @@ import {
|
|
|
105
106
|
NavigationMenuList,
|
|
106
107
|
NavigationMenuTrigger,
|
|
107
108
|
} from "@behavioral-agentic-design-system/core/components/ui/navigation-menu";
|
|
108
|
-
import {
|
|
109
|
+
import {
|
|
110
|
+
Menubar,
|
|
111
|
+
MenubarCheckboxItem,
|
|
112
|
+
MenubarContent,
|
|
113
|
+
MenubarItem,
|
|
114
|
+
MenubarLabel,
|
|
115
|
+
MenubarMenu,
|
|
116
|
+
MenubarRadioGroup,
|
|
117
|
+
MenubarRadioItem,
|
|
118
|
+
MenubarSeparator,
|
|
119
|
+
MenubarShortcut,
|
|
120
|
+
MenubarSub,
|
|
121
|
+
MenubarSubContent,
|
|
122
|
+
MenubarSubTrigger,
|
|
123
|
+
MenubarTrigger,
|
|
124
|
+
} from "@behavioral-agentic-design-system/core/components/ui/menubar";
|
|
125
|
+
import {
|
|
126
|
+
HoverCard,
|
|
127
|
+
HoverCardContent,
|
|
128
|
+
HoverCardHeader,
|
|
129
|
+
HoverCardTitle,
|
|
130
|
+
HoverCardDescription,
|
|
131
|
+
HoverCardTrigger,
|
|
132
|
+
} from "@behavioral-agentic-design-system/core/components/ui/hover-card";
|
|
133
|
+
import { Sparkles, Info, CircleAlert, CalendarIcon, BuildingIcon } from "lucide-react";
|
|
109
134
|
import { Toaster } from "@behavioral-agentic-design-system/core/components/ui/sonner";
|
|
110
135
|
import { toast } from "sonner";
|
|
111
136
|
|
|
@@ -980,6 +1005,44 @@ export default function ComponentsPreview() {
|
|
|
980
1005
|
</div>
|
|
981
1006
|
</Section>
|
|
982
1007
|
|
|
1008
|
+
{/* ── Aspect Ratio ─────────────────────────────────────────── */}
|
|
1009
|
+
<Section title="Aspect Ratio">
|
|
1010
|
+
<div className="space-y-6">
|
|
1011
|
+
<div className="grid grid-cols-3 gap-4">
|
|
1012
|
+
<div className="space-y-2">
|
|
1013
|
+
<p className="text-sm font-medium text-muted-foreground">16 / 9</p>
|
|
1014
|
+
<div className="overflow-hidden rounded-md">
|
|
1015
|
+
<AspectRatio ratio={16 / 9}>
|
|
1016
|
+
<div className="flex h-full w-full items-center justify-center bg-muted text-sm text-muted-foreground">
|
|
1017
|
+
16 / 9
|
|
1018
|
+
</div>
|
|
1019
|
+
</AspectRatio>
|
|
1020
|
+
</div>
|
|
1021
|
+
</div>
|
|
1022
|
+
<div className="space-y-2">
|
|
1023
|
+
<p className="text-sm font-medium text-muted-foreground">1 / 1</p>
|
|
1024
|
+
<div className="overflow-hidden rounded-md">
|
|
1025
|
+
<AspectRatio ratio={1}>
|
|
1026
|
+
<div className="flex h-full w-full items-center justify-center bg-muted text-sm text-muted-foreground">
|
|
1027
|
+
1 / 1
|
|
1028
|
+
</div>
|
|
1029
|
+
</AspectRatio>
|
|
1030
|
+
</div>
|
|
1031
|
+
</div>
|
|
1032
|
+
<div className="space-y-2">
|
|
1033
|
+
<p className="text-sm font-medium text-muted-foreground">2 / 3</p>
|
|
1034
|
+
<div className="overflow-hidden rounded-md">
|
|
1035
|
+
<AspectRatio ratio={2 / 3}>
|
|
1036
|
+
<div className="flex h-full w-full items-center justify-center bg-muted text-sm text-muted-foreground">
|
|
1037
|
+
2 / 3
|
|
1038
|
+
</div>
|
|
1039
|
+
</AspectRatio>
|
|
1040
|
+
</div>
|
|
1041
|
+
</div>
|
|
1042
|
+
</div>
|
|
1043
|
+
</div>
|
|
1044
|
+
</Section>
|
|
1045
|
+
|
|
983
1046
|
<Section title="Navigation Menu">
|
|
984
1047
|
<div className="space-y-6">
|
|
985
1048
|
<div className="space-y-3">
|
|
@@ -1049,6 +1112,153 @@ export default function ComponentsPreview() {
|
|
|
1049
1112
|
</div>
|
|
1050
1113
|
</Section>
|
|
1051
1114
|
|
|
1115
|
+
<Section title="Menubar">
|
|
1116
|
+
<div className="space-y-6">
|
|
1117
|
+
<div className="space-y-3">
|
|
1118
|
+
<p className="text-sm font-medium text-muted-foreground">Full menu bar (File / Edit / View)</p>
|
|
1119
|
+
<Menubar>
|
|
1120
|
+
<MenubarMenu>
|
|
1121
|
+
<MenubarTrigger>File</MenubarTrigger>
|
|
1122
|
+
<MenubarContent>
|
|
1123
|
+
<MenubarItem>
|
|
1124
|
+
New file <MenubarShortcut>⌘N</MenubarShortcut>
|
|
1125
|
+
</MenubarItem>
|
|
1126
|
+
<MenubarItem>
|
|
1127
|
+
Open… <MenubarShortcut>⌘O</MenubarShortcut>
|
|
1128
|
+
</MenubarItem>
|
|
1129
|
+
<MenubarSeparator />
|
|
1130
|
+
<MenubarItem>
|
|
1131
|
+
Save <MenubarShortcut>⌘S</MenubarShortcut>
|
|
1132
|
+
</MenubarItem>
|
|
1133
|
+
<MenubarItem>Export as PDF</MenubarItem>
|
|
1134
|
+
<MenubarSeparator />
|
|
1135
|
+
<MenubarItem variant="destructive">
|
|
1136
|
+
Close file <MenubarShortcut>⌘W</MenubarShortcut>
|
|
1137
|
+
</MenubarItem>
|
|
1138
|
+
</MenubarContent>
|
|
1139
|
+
</MenubarMenu>
|
|
1140
|
+
<MenubarMenu>
|
|
1141
|
+
<MenubarTrigger>Edit</MenubarTrigger>
|
|
1142
|
+
<MenubarContent>
|
|
1143
|
+
<MenubarItem>
|
|
1144
|
+
Undo <MenubarShortcut>⌘Z</MenubarShortcut>
|
|
1145
|
+
</MenubarItem>
|
|
1146
|
+
<MenubarItem>
|
|
1147
|
+
Redo <MenubarShortcut>⇧⌘Z</MenubarShortcut>
|
|
1148
|
+
</MenubarItem>
|
|
1149
|
+
<MenubarSeparator />
|
|
1150
|
+
<MenubarItem>
|
|
1151
|
+
Cut <MenubarShortcut>⌘X</MenubarShortcut>
|
|
1152
|
+
</MenubarItem>
|
|
1153
|
+
<MenubarItem>
|
|
1154
|
+
Copy <MenubarShortcut>⌘C</MenubarShortcut>
|
|
1155
|
+
</MenubarItem>
|
|
1156
|
+
<MenubarItem>
|
|
1157
|
+
Paste <MenubarShortcut>⌘V</MenubarShortcut>
|
|
1158
|
+
</MenubarItem>
|
|
1159
|
+
</MenubarContent>
|
|
1160
|
+
</MenubarMenu>
|
|
1161
|
+
<MenubarMenu>
|
|
1162
|
+
<MenubarTrigger>View</MenubarTrigger>
|
|
1163
|
+
<MenubarContent>
|
|
1164
|
+
<MenubarCheckboxItem checked>Show toolbar</MenubarCheckboxItem>
|
|
1165
|
+
<MenubarCheckboxItem>Show status bar</MenubarCheckboxItem>
|
|
1166
|
+
<MenubarSeparator />
|
|
1167
|
+
<MenubarLabel>Layout</MenubarLabel>
|
|
1168
|
+
<MenubarSeparator />
|
|
1169
|
+
<MenubarRadioGroup value="grid">
|
|
1170
|
+
<MenubarRadioItem value="list">List</MenubarRadioItem>
|
|
1171
|
+
<MenubarRadioItem value="grid">Grid</MenubarRadioItem>
|
|
1172
|
+
<MenubarRadioItem value="kanban">Kanban</MenubarRadioItem>
|
|
1173
|
+
</MenubarRadioGroup>
|
|
1174
|
+
<MenubarSeparator />
|
|
1175
|
+
<MenubarSub>
|
|
1176
|
+
<MenubarSubTrigger>Zoom</MenubarSubTrigger>
|
|
1177
|
+
<MenubarSubContent>
|
|
1178
|
+
<MenubarItem>Zoom in</MenubarItem>
|
|
1179
|
+
<MenubarItem>Zoom out</MenubarItem>
|
|
1180
|
+
<MenubarSeparator />
|
|
1181
|
+
<MenubarItem>Reset zoom</MenubarItem>
|
|
1182
|
+
</MenubarSubContent>
|
|
1183
|
+
</MenubarSub>
|
|
1184
|
+
</MenubarContent>
|
|
1185
|
+
</MenubarMenu>
|
|
1186
|
+
</Menubar>
|
|
1187
|
+
</div>
|
|
1188
|
+
</div>
|
|
1189
|
+
</Section>
|
|
1190
|
+
|
|
1191
|
+
<Section title="Hover Card">
|
|
1192
|
+
<div className="space-y-6">
|
|
1193
|
+
<div className="space-y-3">
|
|
1194
|
+
<p className="text-sm font-medium text-muted-foreground">Profile card (default)</p>
|
|
1195
|
+
<HoverCard>
|
|
1196
|
+
<HoverCardTrigger asChild>
|
|
1197
|
+
<Button variant="link" className="text-sm font-medium">
|
|
1198
|
+
@jordan_reeves
|
|
1199
|
+
</Button>
|
|
1200
|
+
</HoverCardTrigger>
|
|
1201
|
+
<HoverCardContent className="w-72">
|
|
1202
|
+
<HoverCardHeader>
|
|
1203
|
+
<div className="flex items-center gap-3">
|
|
1204
|
+
<Avatar className="size-10">
|
|
1205
|
+
<AvatarImage src="" alt="Jordan Reeves" />
|
|
1206
|
+
<AvatarFallback>JR</AvatarFallback>
|
|
1207
|
+
</Avatar>
|
|
1208
|
+
<div className="min-w-0 flex-1">
|
|
1209
|
+
<HoverCardTitle className="truncate">Jordan Reeves</HoverCardTitle>
|
|
1210
|
+
<HoverCardDescription className="truncate">@jordan_reeves</HoverCardDescription>
|
|
1211
|
+
</div>
|
|
1212
|
+
</div>
|
|
1213
|
+
<p className="mt-2 text-sm leading-relaxed text-foreground">
|
|
1214
|
+
Design systems lead. Building accessible, scalable UI
|
|
1215
|
+
infrastructure for clinical teams.
|
|
1216
|
+
</p>
|
|
1217
|
+
</HoverCardHeader>
|
|
1218
|
+
<Separator className="my-3" />
|
|
1219
|
+
<div className="flex items-center gap-4 text-xs text-muted-foreground">
|
|
1220
|
+
<span className="flex items-center gap-1">
|
|
1221
|
+
<CalendarIcon className="size-3.5" strokeWidth={1.5} />
|
|
1222
|
+
Joined March 2021
|
|
1223
|
+
</span>
|
|
1224
|
+
<span className="flex items-center gap-1">
|
|
1225
|
+
<BuildingIcon className="size-3.5" strokeWidth={1.5} />
|
|
1226
|
+
Lakeview Health
|
|
1227
|
+
</span>
|
|
1228
|
+
</div>
|
|
1229
|
+
</HoverCardContent>
|
|
1230
|
+
</HoverCard>
|
|
1231
|
+
</div>
|
|
1232
|
+
<div className="space-y-3">
|
|
1233
|
+
<p className="text-sm font-medium text-muted-foreground">Link preview (align start)</p>
|
|
1234
|
+
<HoverCard>
|
|
1235
|
+
<HoverCardTrigger asChild>
|
|
1236
|
+
<a
|
|
1237
|
+
href="#"
|
|
1238
|
+
className="inline-flex items-center gap-1.5 text-sm font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-sm"
|
|
1239
|
+
onClick={(e) => e.preventDefault()}
|
|
1240
|
+
>
|
|
1241
|
+
BADS Component Spec
|
|
1242
|
+
</a>
|
|
1243
|
+
</HoverCardTrigger>
|
|
1244
|
+
<HoverCardContent align="start" className="w-72">
|
|
1245
|
+
<HoverCardHeader>
|
|
1246
|
+
<HoverCardTitle>Component Build Spec</HoverCardTitle>
|
|
1247
|
+
<HoverCardDescription className="mt-1 leading-relaxed">
|
|
1248
|
+
The 14-section authoritative walkthrough every new
|
|
1249
|
+
component must satisfy — file placement, API design,
|
|
1250
|
+
token discipline, motion, and accessibility floors.
|
|
1251
|
+
</HoverCardDescription>
|
|
1252
|
+
</HoverCardHeader>
|
|
1253
|
+
<p className="mt-2 text-xs text-muted-foreground">
|
|
1254
|
+
docs/component-build-spec.md
|
|
1255
|
+
</p>
|
|
1256
|
+
</HoverCardContent>
|
|
1257
|
+
</HoverCard>
|
|
1258
|
+
</div>
|
|
1259
|
+
</div>
|
|
1260
|
+
</Section>
|
|
1261
|
+
|
|
1052
1262
|
<Section title="Context Menu">
|
|
1053
1263
|
<div className="space-y-6">
|
|
1054
1264
|
<div className="space-y-3">
|
package/src/app/shell.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { useState, useEffect, useRef, useCallback, createContext, useContext, us
|
|
|
4
4
|
import { Tabs, TabsContent, TabsList, TabsPanels, TabsTrigger } from "@behavioral-agentic-design-system/core/components/ui/tabs";
|
|
5
5
|
import { Badge } from "@behavioral-agentic-design-system/core/components/ui/badge";
|
|
6
6
|
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
7
|
-
import { Sun, Moon, BookOpen, X } from "lucide-react";
|
|
7
|
+
import { Sun, Moon, BookOpen, X, ExternalLink } from "lucide-react";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Inline GitHub mark. Lucide dropped brand icons (Github / Twitter / etc.) in
|
|
@@ -417,6 +417,25 @@ export function Shell({ tabs, defaultTab }: ShellProps) {
|
|
|
417
417
|
<Badge variant="outline" className="ml-2 text-xs hidden sm:inline-flex">{brand.tagline}</Badge>
|
|
418
418
|
</div>
|
|
419
419
|
<div className="ml-auto flex items-center gap-1.5 sm:gap-2 shrink-0">
|
|
420
|
+
{/* Fork-configurable header links — set `headerLinks` in brand.config
|
|
421
|
+
to add buttons (e.g. a link to a fork's prototypes site) without
|
|
422
|
+
shadowing this shell. Read defensively so forks that don't set it
|
|
423
|
+
are unaffected. */}
|
|
424
|
+
{((brand as { headerLinks?: { label: string; href: string }[] }).headerLinks ?? []).map((link) => (
|
|
425
|
+
<Button
|
|
426
|
+
key={link.href}
|
|
427
|
+
asChild
|
|
428
|
+
variant="ghost"
|
|
429
|
+
size="sm"
|
|
430
|
+
className="group h-8 gap-1.5 border border-foreground/30 hover:!bg-foreground hover:!text-background hover:border-foreground"
|
|
431
|
+
title={`Open ${link.label}`}
|
|
432
|
+
>
|
|
433
|
+
<a href={link.href} target="_blank" rel="noreferrer" aria-label={`Open ${link.label} in a new tab`}>
|
|
434
|
+
<ExternalLink className="h-4 w-4 transition-all group-hover:scale-110" strokeWidth={1.5} />
|
|
435
|
+
<span className="text-xs font-medium hidden sm:inline">{link.label}</span>
|
|
436
|
+
</a>
|
|
437
|
+
</Button>
|
|
438
|
+
))}
|
|
420
439
|
{storybookUrl && (
|
|
421
440
|
<Button
|
|
422
441
|
asChild
|
|
@@ -328,32 +328,6 @@ export function HomeTab({ onBrowseDocs, onBrowseComponents }: HomeTabProps) {
|
|
|
328
328
|
|
|
329
329
|
<Separator />
|
|
330
330
|
|
|
331
|
-
{/* COPY-PASTE PROMPTS FOR CLAUDE CODE */}
|
|
332
|
-
<section className="flex flex-col gap-5">
|
|
333
|
-
<div>
|
|
334
|
-
<h2 className="text-2xl font-semibold tracking-tight">
|
|
335
|
-
Copy a prompt to get started
|
|
336
|
-
</h2>
|
|
337
|
-
<p className="mt-1 max-w-2xl text-sm text-muted-foreground">
|
|
338
|
-
Paste any of these into Claude Code exactly as written. Each one
|
|
339
|
-
interviews you for the specifics, so nothing needs filling in first.
|
|
340
|
-
</p>
|
|
341
|
-
</div>
|
|
342
|
-
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4">
|
|
343
|
-
{CLAUDE_PROMPTS.map((p) => (
|
|
344
|
-
<PromptCard
|
|
345
|
-
key={p.id}
|
|
346
|
-
icon={p.icon}
|
|
347
|
-
title={p.title}
|
|
348
|
-
blurb={p.blurb}
|
|
349
|
-
prompt={p.prompt}
|
|
350
|
-
/>
|
|
351
|
-
))}
|
|
352
|
-
</div>
|
|
353
|
-
</section>
|
|
354
|
-
|
|
355
|
-
<Separator />
|
|
356
|
-
|
|
357
331
|
<section className="flex flex-col gap-5">
|
|
358
332
|
<div className="flex items-end justify-between gap-4">
|
|
359
333
|
<div>
|
|
@@ -417,6 +391,32 @@ export function HomeTab({ onBrowseDocs, onBrowseComponents }: HomeTabProps) {
|
|
|
417
391
|
|
|
418
392
|
<Separator />
|
|
419
393
|
|
|
394
|
+
{/* COPY-PASTE PROMPTS FOR CLAUDE CODE */}
|
|
395
|
+
<section className="flex flex-col gap-5">
|
|
396
|
+
<div>
|
|
397
|
+
<h2 className="text-2xl font-semibold tracking-tight">
|
|
398
|
+
Already have BADS installed? Copy a prompt to get started
|
|
399
|
+
</h2>
|
|
400
|
+
<p className="mt-1 max-w-2xl text-sm text-muted-foreground">
|
|
401
|
+
Paste any of these into Claude Code exactly as written. Each one
|
|
402
|
+
interviews you for the specifics, so nothing needs filling in first.
|
|
403
|
+
</p>
|
|
404
|
+
</div>
|
|
405
|
+
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4">
|
|
406
|
+
{CLAUDE_PROMPTS.map((p) => (
|
|
407
|
+
<PromptCard
|
|
408
|
+
key={p.id}
|
|
409
|
+
icon={p.icon}
|
|
410
|
+
title={p.title}
|
|
411
|
+
blurb={p.blurb}
|
|
412
|
+
prompt={p.prompt}
|
|
413
|
+
/>
|
|
414
|
+
))}
|
|
415
|
+
</div>
|
|
416
|
+
</section>
|
|
417
|
+
|
|
418
|
+
<Separator />
|
|
419
|
+
|
|
420
420
|
<section className="flex flex-col gap-4">
|
|
421
421
|
<h2 className="text-sm font-semibold uppercase tracking-wide text-muted-foreground">
|
|
422
422
|
The Docs tab indexes {DOCS_INDEX.length} categories
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"
|
|
4
|
+
|
|
5
|
+
function AspectRatio({
|
|
6
|
+
...props
|
|
7
|
+
}: React.ComponentProps<typeof AspectRatioPrimitive.Root>) {
|
|
8
|
+
return <AspectRatioPrimitive.Root data-slot="aspect-ratio" {...props} />
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { AspectRatio }
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as HoverCardPrimitive from "@radix-ui/react-hover-card"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../lib/utils"
|
|
7
|
+
import { usePortalThemeClass } from "../../hooks/use-portal-theme-class"
|
|
8
|
+
|
|
9
|
+
function HoverCard({
|
|
10
|
+
openDelay = 300,
|
|
11
|
+
closeDelay = 150,
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof HoverCardPrimitive.Root>) {
|
|
14
|
+
return (
|
|
15
|
+
<HoverCardPrimitive.Root
|
|
16
|
+
data-slot="hover-card"
|
|
17
|
+
openDelay={openDelay}
|
|
18
|
+
closeDelay={closeDelay}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function HoverCardTrigger({
|
|
25
|
+
...props
|
|
26
|
+
}: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {
|
|
27
|
+
return (
|
|
28
|
+
<HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function HoverCardContent({
|
|
33
|
+
className,
|
|
34
|
+
align = "center",
|
|
35
|
+
sideOffset = 8,
|
|
36
|
+
...props
|
|
37
|
+
}: React.ComponentProps<typeof HoverCardPrimitive.Content>) {
|
|
38
|
+
const portalThemeClass = usePortalThemeClass()
|
|
39
|
+
return (
|
|
40
|
+
<HoverCardPrimitive.Portal>
|
|
41
|
+
<HoverCardPrimitive.Content
|
|
42
|
+
data-slot="hover-card-content"
|
|
43
|
+
align={align}
|
|
44
|
+
sideOffset={sideOffset}
|
|
45
|
+
className={cn(
|
|
46
|
+
"z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden",
|
|
47
|
+
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
48
|
+
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
49
|
+
"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
50
|
+
portalThemeClass,
|
|
51
|
+
className
|
|
52
|
+
)}
|
|
53
|
+
style={{
|
|
54
|
+
animationDuration: "var(--duration-fast)",
|
|
55
|
+
animationTimingFunction: "var(--ease-out)",
|
|
56
|
+
}}
|
|
57
|
+
{...props}
|
|
58
|
+
/>
|
|
59
|
+
</HoverCardPrimitive.Portal>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function HoverCardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
64
|
+
return (
|
|
65
|
+
<div
|
|
66
|
+
data-slot="hover-card-header"
|
|
67
|
+
className={cn("flex flex-col gap-1", className)}
|
|
68
|
+
{...props}
|
|
69
|
+
/>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function HoverCardTitle({ className, ...props }: React.ComponentProps<"p">) {
|
|
74
|
+
return (
|
|
75
|
+
<p
|
|
76
|
+
data-slot="hover-card-title"
|
|
77
|
+
className={cn("text-sm font-medium", className)}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function HoverCardDescription({
|
|
84
|
+
className,
|
|
85
|
+
...props
|
|
86
|
+
}: React.ComponentProps<"p">) {
|
|
87
|
+
return (
|
|
88
|
+
<p
|
|
89
|
+
data-slot="hover-card-description"
|
|
90
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
91
|
+
{...props}
|
|
92
|
+
/>
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export {
|
|
97
|
+
HoverCard,
|
|
98
|
+
HoverCardTrigger,
|
|
99
|
+
HoverCardContent,
|
|
100
|
+
HoverCardHeader,
|
|
101
|
+
HoverCardTitle,
|
|
102
|
+
HoverCardDescription,
|
|
103
|
+
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// import paths so optional peer deps stay optional.
|
|
4
4
|
export * from "./accordion";
|
|
5
5
|
export * from "./alert";
|
|
6
|
+
export * from "./aspect-ratio";
|
|
6
7
|
export * from "./carousel";
|
|
7
8
|
export * from "./alert-dialog";
|
|
8
9
|
export * from "./avatar";
|
|
@@ -19,8 +20,10 @@ export * from "./context-menu";
|
|
|
19
20
|
export * from "./dialog";
|
|
20
21
|
export * from "./dropdown-menu";
|
|
21
22
|
export * from "./file-upload";
|
|
23
|
+
export * from "./hover-card";
|
|
22
24
|
export * from "./input";
|
|
23
25
|
export * from "./label";
|
|
26
|
+
export * from "./menubar";
|
|
24
27
|
export * from "./navigation-menu";
|
|
25
28
|
export * from "./number-input";
|
|
26
29
|
export * from "./pagination";
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"
|
|
5
|
+
import * as MenubarPrimitive from "@radix-ui/react-menubar"
|
|
6
|
+
|
|
7
|
+
import { cn } from "../../lib/utils"
|
|
8
|
+
import { usePortalThemeClass } from "../../hooks/use-portal-theme-class"
|
|
9
|
+
|
|
10
|
+
function Menubar({
|
|
11
|
+
className,
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Root>) {
|
|
14
|
+
return (
|
|
15
|
+
<MenubarPrimitive.Root
|
|
16
|
+
data-slot="menubar"
|
|
17
|
+
className={cn(
|
|
18
|
+
"flex h-9 items-center gap-1 rounded-md border bg-background p-1 shadow-sm",
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function MenubarMenu({
|
|
27
|
+
...props
|
|
28
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Menu>) {
|
|
29
|
+
return <MenubarPrimitive.Menu data-slot="menubar-menu" {...props} />
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function MenubarGroup({
|
|
33
|
+
...props
|
|
34
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Group>) {
|
|
35
|
+
return <MenubarPrimitive.Group data-slot="menubar-group" {...props} />
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function MenubarPortal({
|
|
39
|
+
...props
|
|
40
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Portal>) {
|
|
41
|
+
return <MenubarPrimitive.Portal data-slot="menubar-portal" {...props} />
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function MenubarRadioGroup({
|
|
45
|
+
...props
|
|
46
|
+
}: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>) {
|
|
47
|
+
return (
|
|
48
|
+
<MenubarPrimitive.RadioGroup data-slot="menubar-radio-group" {...props} />
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function MenubarTrigger({
|
|
53
|
+
className,
|
|
54
|
+
...props
|
|
55
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Trigger>) {
|
|
56
|
+
return (
|
|
57
|
+
<MenubarPrimitive.Trigger
|
|
58
|
+
data-slot="menubar-trigger"
|
|
59
|
+
className={cn(
|
|
60
|
+
"flex cursor-default select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-hidden",
|
|
61
|
+
"transition-colors",
|
|
62
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
63
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
64
|
+
"data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
|
|
65
|
+
className
|
|
66
|
+
)}
|
|
67
|
+
style={{
|
|
68
|
+
transitionDuration: "var(--duration-fast)",
|
|
69
|
+
transitionTimingFunction: "var(--ease-out)",
|
|
70
|
+
}}
|
|
71
|
+
{...props}
|
|
72
|
+
/>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function MenubarContent({
|
|
77
|
+
className,
|
|
78
|
+
align = "start",
|
|
79
|
+
alignOffset = -4,
|
|
80
|
+
sideOffset = 8,
|
|
81
|
+
...props
|
|
82
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Content>) {
|
|
83
|
+
const portalThemeClass = usePortalThemeClass()
|
|
84
|
+
return (
|
|
85
|
+
<MenubarPrimitive.Portal>
|
|
86
|
+
<MenubarPrimitive.Content
|
|
87
|
+
data-slot="menubar-content"
|
|
88
|
+
align={align}
|
|
89
|
+
alignOffset={alignOffset}
|
|
90
|
+
sideOffset={sideOffset}
|
|
91
|
+
className={cn(
|
|
92
|
+
"z-50 min-w-[12rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
|
|
93
|
+
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
94
|
+
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
95
|
+
"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
96
|
+
portalThemeClass,
|
|
97
|
+
className
|
|
98
|
+
)}
|
|
99
|
+
style={{
|
|
100
|
+
animationDuration: "var(--duration-fast)",
|
|
101
|
+
animationTimingFunction: "var(--ease-out)",
|
|
102
|
+
}}
|
|
103
|
+
{...props}
|
|
104
|
+
/>
|
|
105
|
+
</MenubarPrimitive.Portal>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function MenubarItem({
|
|
110
|
+
className,
|
|
111
|
+
inset,
|
|
112
|
+
variant = "default",
|
|
113
|
+
...props
|
|
114
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Item> & {
|
|
115
|
+
inset?: boolean
|
|
116
|
+
variant?: "default" | "destructive"
|
|
117
|
+
}) {
|
|
118
|
+
return (
|
|
119
|
+
<MenubarPrimitive.Item
|
|
120
|
+
data-slot="menubar-item"
|
|
121
|
+
data-inset={inset}
|
|
122
|
+
data-variant={variant}
|
|
123
|
+
className={cn(
|
|
124
|
+
"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden",
|
|
125
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
126
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
127
|
+
"data-[inset]:pl-8",
|
|
128
|
+
"data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive",
|
|
129
|
+
"dark:data-[variant=destructive]:focus:bg-destructive/20",
|
|
130
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
131
|
+
"data-[variant=destructive]:*:[svg]:text-destructive!",
|
|
132
|
+
className
|
|
133
|
+
)}
|
|
134
|
+
{...props}
|
|
135
|
+
/>
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function MenubarCheckboxItem({
|
|
140
|
+
className,
|
|
141
|
+
children,
|
|
142
|
+
checked,
|
|
143
|
+
...props
|
|
144
|
+
}: React.ComponentProps<typeof MenubarPrimitive.CheckboxItem>) {
|
|
145
|
+
return (
|
|
146
|
+
<MenubarPrimitive.CheckboxItem
|
|
147
|
+
data-slot="menubar-checkbox-item"
|
|
148
|
+
className={cn(
|
|
149
|
+
"relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden",
|
|
150
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
151
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
152
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
153
|
+
className
|
|
154
|
+
)}
|
|
155
|
+
checked={checked}
|
|
156
|
+
{...props}
|
|
157
|
+
>
|
|
158
|
+
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
159
|
+
<MenubarPrimitive.ItemIndicator>
|
|
160
|
+
<CheckIcon className="size-4" strokeWidth={1.5} />
|
|
161
|
+
</MenubarPrimitive.ItemIndicator>
|
|
162
|
+
</span>
|
|
163
|
+
{children}
|
|
164
|
+
</MenubarPrimitive.CheckboxItem>
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function MenubarRadioItem({
|
|
169
|
+
className,
|
|
170
|
+
children,
|
|
171
|
+
...props
|
|
172
|
+
}: React.ComponentProps<typeof MenubarPrimitive.RadioItem>) {
|
|
173
|
+
return (
|
|
174
|
+
<MenubarPrimitive.RadioItem
|
|
175
|
+
data-slot="menubar-radio-item"
|
|
176
|
+
className={cn(
|
|
177
|
+
"relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden",
|
|
178
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
179
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
180
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
181
|
+
className
|
|
182
|
+
)}
|
|
183
|
+
{...props}
|
|
184
|
+
>
|
|
185
|
+
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
186
|
+
<MenubarPrimitive.ItemIndicator>
|
|
187
|
+
<CircleIcon className="size-2 fill-current" />
|
|
188
|
+
</MenubarPrimitive.ItemIndicator>
|
|
189
|
+
</span>
|
|
190
|
+
{children}
|
|
191
|
+
</MenubarPrimitive.RadioItem>
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function MenubarLabel({
|
|
196
|
+
className,
|
|
197
|
+
inset,
|
|
198
|
+
...props
|
|
199
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Label> & {
|
|
200
|
+
inset?: boolean
|
|
201
|
+
}) {
|
|
202
|
+
return (
|
|
203
|
+
<MenubarPrimitive.Label
|
|
204
|
+
data-slot="menubar-label"
|
|
205
|
+
data-inset={inset}
|
|
206
|
+
className={cn(
|
|
207
|
+
"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
|
|
208
|
+
className
|
|
209
|
+
)}
|
|
210
|
+
{...props}
|
|
211
|
+
/>
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function MenubarSeparator({
|
|
216
|
+
className,
|
|
217
|
+
...props
|
|
218
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Separator>) {
|
|
219
|
+
return (
|
|
220
|
+
<MenubarPrimitive.Separator
|
|
221
|
+
data-slot="menubar-separator"
|
|
222
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
223
|
+
{...props}
|
|
224
|
+
/>
|
|
225
|
+
)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function MenubarShortcut({
|
|
229
|
+
className,
|
|
230
|
+
...props
|
|
231
|
+
}: React.ComponentProps<"span">) {
|
|
232
|
+
return (
|
|
233
|
+
<span
|
|
234
|
+
data-slot="menubar-shortcut"
|
|
235
|
+
className={cn(
|
|
236
|
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
237
|
+
className
|
|
238
|
+
)}
|
|
239
|
+
{...props}
|
|
240
|
+
/>
|
|
241
|
+
)
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function MenubarSub({
|
|
245
|
+
...props
|
|
246
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Sub>) {
|
|
247
|
+
return <MenubarPrimitive.Sub data-slot="menubar-sub" {...props} />
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function MenubarSubTrigger({
|
|
251
|
+
className,
|
|
252
|
+
inset,
|
|
253
|
+
children,
|
|
254
|
+
...props
|
|
255
|
+
}: React.ComponentProps<typeof MenubarPrimitive.SubTrigger> & {
|
|
256
|
+
inset?: boolean
|
|
257
|
+
}) {
|
|
258
|
+
return (
|
|
259
|
+
<MenubarPrimitive.SubTrigger
|
|
260
|
+
data-slot="menubar-sub-trigger"
|
|
261
|
+
data-inset={inset}
|
|
262
|
+
className={cn(
|
|
263
|
+
"flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden",
|
|
264
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
265
|
+
"data-[inset]:pl-8",
|
|
266
|
+
"data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
|
|
267
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
268
|
+
className
|
|
269
|
+
)}
|
|
270
|
+
{...props}
|
|
271
|
+
>
|
|
272
|
+
{children}
|
|
273
|
+
<ChevronRightIcon className="ml-auto size-4" strokeWidth={1.5} />
|
|
274
|
+
</MenubarPrimitive.SubTrigger>
|
|
275
|
+
)
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function MenubarSubContent({
|
|
279
|
+
className,
|
|
280
|
+
...props
|
|
281
|
+
}: React.ComponentProps<typeof MenubarPrimitive.SubContent>) {
|
|
282
|
+
return (
|
|
283
|
+
<MenubarPrimitive.SubContent
|
|
284
|
+
data-slot="menubar-sub-content"
|
|
285
|
+
className={cn(
|
|
286
|
+
"z-50 min-w-[8rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg",
|
|
287
|
+
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
288
|
+
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
289
|
+
"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
290
|
+
className
|
|
291
|
+
)}
|
|
292
|
+
style={{
|
|
293
|
+
animationDuration: "var(--duration-fast)",
|
|
294
|
+
animationTimingFunction: "var(--ease-out)",
|
|
295
|
+
}}
|
|
296
|
+
{...props}
|
|
297
|
+
/>
|
|
298
|
+
)
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export {
|
|
302
|
+
Menubar,
|
|
303
|
+
MenubarMenu,
|
|
304
|
+
MenubarGroup,
|
|
305
|
+
MenubarPortal,
|
|
306
|
+
MenubarRadioGroup,
|
|
307
|
+
MenubarTrigger,
|
|
308
|
+
MenubarContent,
|
|
309
|
+
MenubarItem,
|
|
310
|
+
MenubarCheckboxItem,
|
|
311
|
+
MenubarRadioItem,
|
|
312
|
+
MenubarLabel,
|
|
313
|
+
MenubarSeparator,
|
|
314
|
+
MenubarShortcut,
|
|
315
|
+
MenubarSub,
|
|
316
|
+
MenubarSubTrigger,
|
|
317
|
+
MenubarSubContent,
|
|
318
|
+
}
|