@inbeat/ui 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/package.json +100 -0
  3. package/src/components/alert-dialog.tsx +246 -0
  4. package/src/components/alert.tsx +66 -0
  5. package/src/components/app-nav.tsx +55 -0
  6. package/src/components/app-shell.tsx +95 -0
  7. package/src/components/avatar.tsx +73 -0
  8. package/src/components/badge.tsx +42 -0
  9. package/src/components/breadcrumb.tsx +109 -0
  10. package/src/components/button.tsx +75 -0
  11. package/src/components/calendar.tsx +220 -0
  12. package/src/components/carousel.tsx +83 -0
  13. package/src/components/checkbox.tsx +29 -0
  14. package/src/components/collapsible-section.tsx +88 -0
  15. package/src/components/combobox.tsx +351 -0
  16. package/src/components/data-table-shell.tsx +6 -0
  17. package/src/components/data-table-sortable-header.tsx +29 -0
  18. package/src/components/data-table.tsx +141 -0
  19. package/src/components/destructive-action-dialog.tsx +108 -0
  20. package/src/components/dialog.tsx +187 -0
  21. package/src/components/dropdown-menu.tsx +228 -0
  22. package/src/components/empty-state.tsx +55 -0
  23. package/src/components/field.tsx +248 -0
  24. package/src/components/icon-button.tsx +51 -0
  25. package/src/components/input-group.tsx +170 -0
  26. package/src/components/input.tsx +22 -0
  27. package/src/components/label.tsx +24 -0
  28. package/src/components/labeled-field.tsx +18 -0
  29. package/src/components/load-more-sentinel.tsx +12 -0
  30. package/src/components/member-avatar-stack.tsx +44 -0
  31. package/src/components/multi-select-popover.tsx +202 -0
  32. package/src/components/nav-user.tsx +71 -0
  33. package/src/components/number-dot.tsx +13 -0
  34. package/src/components/person-identity.tsx +52 -0
  35. package/src/components/platform-disclaimer.tsx +70 -0
  36. package/src/components/popover.tsx +92 -0
  37. package/src/components/portal-container.tsx +21 -0
  38. package/src/components/progress.tsx +23 -0
  39. package/src/components/search-input.tsx +57 -0
  40. package/src/components/select.tsx +232 -0
  41. package/src/components/separator.tsx +28 -0
  42. package/src/components/sheet.tsx +147 -0
  43. package/src/components/sidebar.tsx +471 -0
  44. package/src/components/skeleton.tsx +13 -0
  45. package/src/components/sonner.tsx +46 -0
  46. package/src/components/spinner.tsx +21 -0
  47. package/src/components/table.tsx +92 -0
  48. package/src/components/tabs.tsx +62 -0
  49. package/src/components/textarea.tsx +18 -0
  50. package/src/components/toggle-pills.tsx +32 -0
  51. package/src/components/tooltip.tsx +67 -0
  52. package/src/hooks/use-mobile.ts +21 -0
  53. package/src/lib/easing.ts +5 -0
  54. package/src/lib/initials.ts +12 -0
  55. package/src/lib/utils.ts +6 -0
  56. package/theme.css +141 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,76 @@
1
+ # Changelog
2
+
3
+ ## [0.7.0](https://github.com/Genoux/ib-toolkit/compare/ui-v0.6.1...ui-v0.7.0) (2026-10-01)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * consumers must drop the @inbeat registry line from .npmrc/bunfig and the NODE_AUTH_TOKEN setup.
9
+
10
+ ### Features
11
+
12
+ * publish [@inbeat](https://github.com/inbeat) packages publicly on npm ([#27](https://github.com/Genoux/ib-toolkit/issues/27)) ([2bd9f53](https://github.com/Genoux/ib-toolkit/commit/2bd9f53c2d4dd030bdee037b8b1dce1e1bb828b5))
13
+
14
+ ## [0.6.1](https://github.com/Genoux/ib-toolkit/compare/ui-v0.6.0...ui-v0.6.1) (2026-10-01)
15
+
16
+
17
+ ### Miscellaneous Chores
18
+
19
+ * **ui:** Synchronize inbeat versions
20
+
21
+ ## [0.6.0](https://github.com/Genoux/ib-toolkit/compare/ui-v0.5.0...ui-v0.6.0) (2026-10-01)
22
+
23
+
24
+ ### Miscellaneous Chores
25
+
26
+ * **ui:** Synchronize inbeat versions
27
+
28
+ ## [0.5.0](https://github.com/Genoux/ib-toolkit/compare/ui-v0.4.0...ui-v0.5.0) (2026-10-01)
29
+
30
+
31
+ ### Miscellaneous Chores
32
+
33
+ * **ui:** Synchronize inbeat versions
34
+
35
+ ## [0.4.0](https://github.com/Genoux/ib-toolkit/compare/ui-v0.3.0...ui-v0.4.0) (2026-09-30)
36
+
37
+
38
+ ### ⚠ BREAKING CHANGES
39
+
40
+ * **standards:** sync skills to .agents/skills only ([#15](https://github.com/Genoux/ib-toolkit/issues/15))
41
+
42
+ ### Features
43
+
44
+ * **standards:** sync skills to .agents/skills only ([#15](https://github.com/Genoux/ib-toolkit/issues/15)) ([cd3e8a2](https://github.com/Genoux/ib-toolkit/commit/cd3e8a21f028790ad84c26dc1cc832475885c461))
45
+
46
+ ## [0.3.0](https://github.com/Genoux/ib-toolkit/compare/ui-v0.2.0...ui-v0.3.0) (2026-09-30)
47
+
48
+
49
+ ### Miscellaneous Chores
50
+
51
+ * **ui:** Synchronize inbeat versions
52
+
53
+ ## [0.2.0](https://github.com/Genoux/ib-toolkit/compare/ui-v0.1.2...ui-v0.2.0) (2026-09-30)
54
+
55
+
56
+ ### ⚠ BREAKING CHANGES
57
+
58
+ * **ui,next:** harden ui peers, csp and rate-limit ip ([#8](https://github.com/Genoux/ib-toolkit/issues/8))
59
+
60
+ ### Bug Fixes
61
+
62
+ * **ui,next:** harden ui peers, csp and rate-limit ip ([#8](https://github.com/Genoux/ib-toolkit/issues/8)) ([4ad992c](https://github.com/Genoux/ib-toolkit/commit/4ad992c96181a21c3dbee0bb542d9afe32163deb))
63
+
64
+ ## [0.1.2](https://github.com/Genoux/ib-toolkit/compare/ui-v0.1.1...ui-v0.1.2) (2026-09-30)
65
+
66
+
67
+ ### Bug Fixes
68
+
69
+ * resolve workspace ranges from manifests on publish ([#5](https://github.com/Genoux/ib-toolkit/issues/5)) ([0f4328e](https://github.com/Genoux/ib-toolkit/commit/0f4328eb0897501380880f429a952d9d228563a2))
70
+
71
+ ## [0.1.1](https://github.com/Genoux/ib-toolkit/compare/ui-v0.1.0...ui-v0.1.1) (2026-09-30)
72
+
73
+
74
+ ### Miscellaneous Chores
75
+
76
+ * **ui:** Synchronize inbeat versions
package/package.json ADDED
@@ -0,0 +1,100 @@
1
+ {
2
+ "name": "@inbeat/ui",
3
+ "version": "0.7.0",
4
+ "description": "inBeat design tokens and primitives (Radix + Tailwind v4), shipped as source",
5
+ "type": "module",
6
+ "sideEffects": [
7
+ "*.css"
8
+ ],
9
+ "files": [
10
+ "CHANGELOG.md",
11
+ "src",
12
+ "theme.css"
13
+ ],
14
+ "exports": {
15
+ "./theme.css": "./theme.css",
16
+ "./components/*": "./src/components/*.tsx",
17
+ "./hooks/*": "./src/hooks/*.ts",
18
+ "./lib/*": "./src/lib/*.ts"
19
+ },
20
+ "scripts": {
21
+ "typecheck": "tsc --noEmit",
22
+ "storybook": "storybook dev -p 6006",
23
+ "build-storybook": "storybook build -o storybook-static"
24
+ },
25
+ "dependencies": {
26
+ "class-variance-authority": "^0.7.1",
27
+ "clsx": "^2.1.1",
28
+ "tailwind-merge": "^3.4.0"
29
+ },
30
+ "peerDependencies": {
31
+ "@base-ui/react": "^1.2.0",
32
+ "@tanstack/react-table": "^8.21.3",
33
+ "embla-carousel-react": "^8.6.0",
34
+ "lucide-react": ">=0.500.0",
35
+ "motion": "^12",
36
+ "next-themes": "^0.4.6",
37
+ "radix-ui": "^1.4.3",
38
+ "react": "^19",
39
+ "react-day-picker": "^9",
40
+ "react-dom": "^19",
41
+ "sonner": "^2"
42
+ },
43
+ "peerDependenciesMeta": {
44
+ "@base-ui/react": {
45
+ "optional": true
46
+ },
47
+ "@tanstack/react-table": {
48
+ "optional": true
49
+ },
50
+ "embla-carousel-react": {
51
+ "optional": true
52
+ },
53
+ "next-themes": {
54
+ "optional": true
55
+ },
56
+ "react-day-picker": {
57
+ "optional": true
58
+ },
59
+ "sonner": {
60
+ "optional": true
61
+ }
62
+ },
63
+ "devDependencies": {
64
+ "@base-ui/react": "^1.2.0",
65
+ "@fontsource-variable/geist": "^5.3.0",
66
+ "@fontsource-variable/geist-mono": "^5.3.0",
67
+ "@inbeat/config": "^0.7.0",
68
+ "@storybook/addon-a11y": "^10.6.0",
69
+ "@storybook/addon-docs": "^10.6.0",
70
+ "@storybook/addon-themes": "^10.6.0",
71
+ "@storybook/react-vite": "^10.6.0",
72
+ "@tailwindcss/vite": "^4.3.3",
73
+ "@tanstack/react-table": "^8.21.3",
74
+ "@types/react": "^19",
75
+ "@types/react-dom": "^19",
76
+ "embla-carousel-react": "^8.6.0",
77
+ "lucide-react": "^1.14.0",
78
+ "motion": "^12.34.0",
79
+ "next-themes": "^0.4.6",
80
+ "radix-ui": "^1.4.3",
81
+ "react": "19.2.3",
82
+ "react-day-picker": "^9.14.0",
83
+ "react-dom": "19.2.3",
84
+ "shadcn": "^4.21.0",
85
+ "sonner": "^2.0.7",
86
+ "storybook": "^10.6.0",
87
+ "tailwindcss": "^4.3.3",
88
+ "tw-animate-css": "^1.4.0",
89
+ "vite": "^8.3.1"
90
+ },
91
+ "repository": {
92
+ "type": "git",
93
+ "url": "git+https://github.com/Genoux/ib-toolkit.git",
94
+ "directory": "packages/ui"
95
+ },
96
+ "publishConfig": {
97
+ "access": "public"
98
+ },
99
+ "license": "UNLICENSED"
100
+ }
@@ -0,0 +1,246 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { AlertDialog as AlertDialogPrimitive } from "radix-ui"
5
+ import { AnimatePresence, motion } from "motion/react"
6
+
7
+ import { cn } from "../lib/utils"
8
+ import { Button } from "./button"
9
+ import { EASING_FUNCTION } from "../lib/easing"
10
+
11
+ const AlertDialogOpenContext = React.createContext(false)
12
+
13
+ function AlertDialog({
14
+ open: controlledOpen,
15
+ defaultOpen,
16
+ onOpenChange,
17
+ ...props
18
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
19
+ const [uncontrolledOpen, setUncontrolledOpen] = React.useState(
20
+ defaultOpen ?? false
21
+ )
22
+ const isOpen = controlledOpen ?? uncontrolledOpen
23
+
24
+ const handleOpenChange = (next: boolean) => {
25
+ setUncontrolledOpen(next)
26
+ onOpenChange?.(next)
27
+ }
28
+
29
+ return (
30
+ <AlertDialogOpenContext.Provider value={isOpen}>
31
+ <AlertDialogPrimitive.Root
32
+ data-slot="alert-dialog"
33
+ open={isOpen}
34
+ onOpenChange={handleOpenChange}
35
+ {...props}
36
+ />
37
+ </AlertDialogOpenContext.Provider>
38
+ )
39
+ }
40
+
41
+ function AlertDialogTrigger({
42
+ ...props
43
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
44
+ return (
45
+ <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
46
+ )
47
+ }
48
+
49
+ function AlertDialogPortal({
50
+ ...props
51
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
52
+ return (
53
+ <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
54
+ )
55
+ }
56
+
57
+ function AlertDialogContent({
58
+ className,
59
+ size = "default",
60
+ children,
61
+ ...props
62
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {
63
+ size?: "default" | "sm"
64
+ }) {
65
+ const isOpen = React.useContext(AlertDialogOpenContext)
66
+
67
+ return (
68
+ <AlertDialogPortal forceMount>
69
+ <AnimatePresence>
70
+ {isOpen && (
71
+ <AlertDialogPrimitive.Overlay
72
+ data-slot="alert-dialog-overlay"
73
+ asChild
74
+ forceMount
75
+ >
76
+ <motion.div
77
+ initial={{ opacity: 0 }}
78
+ animate={{ opacity: 1 }}
79
+ exit={{ opacity: 0 }}
80
+ transition={{ duration: 0.15, ease: EASING_FUNCTION.dialog }}
81
+ style={{ willChange: "opacity" }}
82
+ className="fixed inset-0 z-50 bg-black/20 backdrop-blur-sm supports-backdrop-filter:backdrop-blur-sm"
83
+ />
84
+ </AlertDialogPrimitive.Overlay>
85
+ )}
86
+ </AnimatePresence>
87
+
88
+ <AnimatePresence>
89
+ {isOpen && (
90
+ <motion.div
91
+ initial={{ opacity: 0, scale: 0.95 }}
92
+ animate={{ opacity: 1, scale: 1 }}
93
+ exit={{ opacity: 0, scale: 0.95 }}
94
+ transition={{ duration: 0.15, ease: EASING_FUNCTION.dialog }}
95
+ style={{ willChange: "transform, opacity" }}
96
+ className="fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 data-[size=default]:max-w-xs data-[size=default]:sm:max-w-sm data-[size=sm]:max-w-xs"
97
+ data-size={size}
98
+ >
99
+ <AlertDialogPrimitive.Content
100
+ data-slot="alert-dialog-content"
101
+ data-size={size}
102
+ forceMount
103
+ className={cn(
104
+ "bg-background ring-foreground/10 gap-4 rounded-xl p-4 ring-1 group/alert-dialog-content grid w-full outline-none",
105
+ className
106
+ )}
107
+ {...props}
108
+ >
109
+ {children}
110
+ </AlertDialogPrimitive.Content>
111
+ </motion.div>
112
+ )}
113
+ </AnimatePresence>
114
+ </AlertDialogPortal>
115
+ )
116
+ }
117
+
118
+ function AlertDialogHeader({
119
+ className,
120
+ ...props
121
+ }: React.ComponentProps<"div">) {
122
+ return (
123
+ <div
124
+ data-slot="alert-dialog-header"
125
+ className={cn("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]", className)}
126
+ {...props}
127
+ />
128
+ )
129
+ }
130
+
131
+ function AlertDialogFooter({
132
+ className,
133
+ ...props
134
+ }: React.ComponentProps<"div">) {
135
+ return (
136
+ <div
137
+ data-slot="alert-dialog-footer"
138
+ className={cn(
139
+ "bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",
140
+ className
141
+ )}
142
+ {...props}
143
+ />
144
+ )
145
+ }
146
+
147
+ function AlertDialogMedia({
148
+ className,
149
+ ...props
150
+ }: React.ComponentProps<"div">) {
151
+ return (
152
+ <div
153
+ data-slot="alert-dialog-media"
154
+ className={cn("bg-muted mb-2 inline-flex size-10 items-center justify-center rounded-md sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6", className)}
155
+ {...props}
156
+ />
157
+ )
158
+ }
159
+
160
+ function AlertDialogTitle({
161
+ className,
162
+ ...props
163
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
164
+ return (
165
+ <AlertDialogPrimitive.Title
166
+ data-slot="alert-dialog-title"
167
+ className={cn("text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2", className)}
168
+ {...props}
169
+ />
170
+ )
171
+ }
172
+
173
+ function AlertDialogDescription({
174
+ className,
175
+ ...props
176
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
177
+ return (
178
+ <AlertDialogPrimitive.Description
179
+ data-slot="alert-dialog-description"
180
+ className={cn("text-muted-foreground *:[a]:hover:text-foreground text-sm text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3", className)}
181
+ {...props}
182
+ />
183
+ )
184
+ }
185
+
186
+ // Radix Action/Cancel must wrap Button (`asChild` → single `<Button>`). Never `Button asChild` → Action:
187
+ // Slot.children.only fails when those primitives are not the direct single child of Radix `asChild`.
188
+ function AlertDialogAction({
189
+ className,
190
+ variant = "default",
191
+ size = "default",
192
+ ...props
193
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Action> &
194
+ Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
195
+ const { asChild: _asChild, ...buttonProps } = props as typeof props & {
196
+ asChild?: boolean
197
+ }
198
+ return (
199
+ <AlertDialogPrimitive.Action asChild>
200
+ <Button
201
+ data-slot="alert-dialog-action"
202
+ variant={variant}
203
+ size={size}
204
+ className={cn(className)}
205
+ {...buttonProps}
206
+ />
207
+ </AlertDialogPrimitive.Action>
208
+ )
209
+ }
210
+
211
+ function AlertDialogCancel({
212
+ className,
213
+ variant = "outline",
214
+ size = "default",
215
+ ...props
216
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Cancel> &
217
+ Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
218
+ const { asChild: _asChild, ...buttonProps } = props as typeof props & {
219
+ asChild?: boolean
220
+ }
221
+ return (
222
+ <AlertDialogPrimitive.Cancel asChild>
223
+ <Button
224
+ data-slot="alert-dialog-cancel"
225
+ variant={variant}
226
+ size={size}
227
+ className={cn(className)}
228
+ {...buttonProps}
229
+ />
230
+ </AlertDialogPrimitive.Cancel>
231
+ )
232
+ }
233
+
234
+ export {
235
+ AlertDialog,
236
+ AlertDialogAction,
237
+ AlertDialogCancel,
238
+ AlertDialogContent,
239
+ AlertDialogDescription,
240
+ AlertDialogFooter,
241
+ AlertDialogHeader,
242
+ AlertDialogMedia,
243
+ AlertDialogPortal,
244
+ AlertDialogTitle,
245
+ AlertDialogTrigger,
246
+ }
@@ -0,0 +1,66 @@
1
+ import * as React from "react"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
+
4
+ import { cn } from "../lib/utils"
5
+
6
+ const alertVariants = cva(
7
+ "relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-2xl border px-3 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: "bg-card text-card-foreground",
12
+ destructive:
13
+ "bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 [&>svg]:text-current",
14
+ },
15
+ },
16
+ defaultVariants: {
17
+ variant: "default",
18
+ },
19
+ }
20
+ )
21
+
22
+ function Alert({
23
+ className,
24
+ variant,
25
+ ...props
26
+ }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
27
+ return (
28
+ <div
29
+ data-slot="alert"
30
+ role="alert"
31
+ className={cn(alertVariants({ variant }), className)}
32
+ {...props}
33
+ />
34
+ )
35
+ }
36
+
37
+ function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
38
+ return (
39
+ <div
40
+ data-slot="alert-title"
41
+ className={cn(
42
+ "col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight text-sm",
43
+ className
44
+ )}
45
+ {...props}
46
+ />
47
+ )
48
+ }
49
+
50
+ function AlertDescription({
51
+ className,
52
+ ...props
53
+ }: React.ComponentProps<"div">) {
54
+ return (
55
+ <div
56
+ data-slot="alert-description"
57
+ className={cn(
58
+ "col-start-2 grid justify-items-start gap-1 text-xs text-muted-foreground [&_p]:leading-relaxed",
59
+ className
60
+ )}
61
+ {...props}
62
+ />
63
+ )
64
+ }
65
+
66
+ export { Alert, AlertTitle, AlertDescription }
@@ -0,0 +1,55 @@
1
+ "use client";
2
+
3
+ import type { LucideIcon } from "lucide-react";
4
+ import type { ReactElement, ReactNode } from "react";
5
+ import {
6
+ SidebarGroup,
7
+ SidebarGroupContent,
8
+ SidebarMenu,
9
+ SidebarMenuButton,
10
+ SidebarMenuItem,
11
+ } from "./sidebar";
12
+
13
+ type AppNavItem = {
14
+ title: string;
15
+ icon: LucideIcon;
16
+ isActive?: boolean;
17
+ disabled?: boolean;
18
+ };
19
+
20
+ type AppNavProps<Item extends AppNavItem> = {
21
+ items: Item[];
22
+ renderLink: (item: Item, content: ReactNode) => ReactElement;
23
+ };
24
+
25
+ function AppNav<Item extends AppNavItem>({ items, renderLink }: AppNavProps<Item>) {
26
+ return (
27
+ <SidebarGroup>
28
+ <SidebarGroupContent>
29
+ <SidebarMenu>
30
+ {items.map((item) => (
31
+ <SidebarMenuItem key={item.title}>
32
+ <SidebarMenuButton
33
+ asChild
34
+ isActive={item.isActive}
35
+ aria-disabled={item.disabled}
36
+ className={item.disabled ? "opacity-50" : undefined}
37
+ >
38
+ {renderLink(
39
+ item,
40
+ <>
41
+ <item.icon />
42
+ <span>{item.title}</span>
43
+ </>,
44
+ )}
45
+ </SidebarMenuButton>
46
+ </SidebarMenuItem>
47
+ ))}
48
+ </SidebarMenu>
49
+ </SidebarGroupContent>
50
+ </SidebarGroup>
51
+ );
52
+ }
53
+
54
+ export { AppNav };
55
+ export type { AppNavItem };
@@ -0,0 +1,95 @@
1
+ "use client";
2
+
3
+ import type { CSSProperties, ComponentProps, ReactNode } from "react";
4
+ import { cn } from "../lib/utils";
5
+ import { Separator } from "./separator";
6
+ import {
7
+ Sidebar,
8
+ SidebarContent,
9
+ SidebarFooter,
10
+ SidebarHeader,
11
+ SidebarInset,
12
+ SidebarMenu,
13
+ SidebarMenuItem,
14
+ SidebarProvider,
15
+ SidebarTrigger,
16
+ } from "./sidebar";
17
+
18
+ type AppShellProps = {
19
+ sidebarHeader: ReactNode;
20
+ sidebar: ReactNode;
21
+ sidebarFooter?: ReactNode;
22
+ header?: ReactNode;
23
+ children: ReactNode;
24
+ variant?: ComponentProps<typeof Sidebar>["variant"];
25
+ collapsible?: ComponentProps<typeof Sidebar>["collapsible"];
26
+ sidebarWidth?: string;
27
+ headerVariant?: keyof typeof HEADER_VARIANTS;
28
+ };
29
+
30
+ const HEADER_VARIANTS = {
31
+ bordered: { header: "h-(--header-height) border-b", bar: "px-3", separator: "mx-2" },
32
+ plain: { header: "h-14", bar: "px-4", separator: "mr-2" },
33
+ } as const;
34
+
35
+ function AppShellLogo({ children }: { children: ReactNode }) {
36
+ return (
37
+ <SidebarMenu>
38
+ <SidebarMenuItem>
39
+ <div className="p-1.5">{children}</div>
40
+ </SidebarMenuItem>
41
+ </SidebarMenu>
42
+ );
43
+ }
44
+
45
+ function AppShell({
46
+ sidebarHeader,
47
+ sidebar,
48
+ sidebarFooter,
49
+ header,
50
+ children,
51
+ variant = "sidebar",
52
+ collapsible = "offcanvas",
53
+ sidebarWidth = "220px",
54
+ headerVariant = "bordered",
55
+ }: AppShellProps) {
56
+ const headerStyle = HEADER_VARIANTS[headerVariant];
57
+ return (
58
+ <SidebarProvider
59
+ className="h-svh overflow-hidden"
60
+ style={
61
+ {
62
+ "--sidebar-width": sidebarWidth,
63
+ "--header-height": "calc(var(--spacing) * 12)",
64
+ } as CSSProperties
65
+ }
66
+ >
67
+ <Sidebar variant={variant} collapsible={collapsible}>
68
+ <SidebarHeader>{sidebarHeader}</SidebarHeader>
69
+ <SidebarContent>{sidebar}</SidebarContent>
70
+ {sidebarFooter ? <SidebarFooter>{sidebarFooter}</SidebarFooter> : null}
71
+ </Sidebar>
72
+ <SidebarInset
73
+ className={
74
+ variant === "inset"
75
+ ? "max-h-[calc(100svh-1rem)] min-h-0 overflow-hidden"
76
+ : "max-h-svh min-h-0 overflow-hidden"
77
+ }
78
+ >
79
+ <header className={cn("flex shrink-0 items-center gap-2", headerStyle.header)}>
80
+ <div className={cn("flex w-full items-center gap-1", headerStyle.bar)}>
81
+ <SidebarTrigger className="-ml-1" />
82
+ <Separator
83
+ orientation="vertical"
84
+ className={cn(headerStyle.separator, "data-[orientation=vertical]:h-4")}
85
+ />
86
+ {header ? <div className="flex w-full items-center justify-between">{header}</div> : null}
87
+ </div>
88
+ </header>
89
+ <div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto">{children}</div>
90
+ </SidebarInset>
91
+ </SidebarProvider>
92
+ );
93
+ }
94
+
95
+ export { AppShell, AppShellLogo };